2

I am developing chat application using socket.io in objective-c. I am facing issue of loosing offline messages. The scenario is while I have couple of offline messages in queue, when client(iOS App) is connected. Initially it disconnects directly saying "Session ID Unknown". Below is the code of connection using socket

NSURL* url = [[NSURL alloc] initWithString:@"MYURL"];
self.socket = [[SocketIOClient alloc] initWithSocketURL:url config:@{@"log": @NO, @"reconnectAttempts" : @50, @"reconnects" : @YES, @"forcePolling": @YES}];

if (![self.socket.engine connected])
{
    [self.socket connectWithTimeoutAfter:20000 withHandler:^{
        NSLog(@"Socket Conencted");
    }];
}

[self.socket off:@"disconnect"];
[self.socket off:@"error"];
[self.socket off:@"add user"];
[self.socket off:@"private message"];
[self.socket off:@"connect"];
[self.socket off:@"startChat"];
[self.socket off:@"delivered"];
[self.socket off:@"user image"];
[self.socket off:@"received server"];

[self.socket on:@"connect" callback:^(NSArray * data, SocketAckEmitter * ack) {
}];

[self.socket on:@"user image" callback:^(NSArray * data, SocketAckEmitter * ack) {
}];

.....

Logs_Application.txt

Chat working properly but some times it loosing messages and delivery reports.

However, this kind of issue is not observed in all users, but couple of users are facing this kind of issue.

Looking forward to hear with some solution for the same.

Let me know if I can provide more information for better understanding the issue.

Vatsal K
  • 1,031
  • 10
  • 31
  • checkout this: https://stackoverflow.com/questions/30713635/node-js-with-socket-io-long-polling-fails-and-throws-code1-messagesessi/33341659#33341659 – Saheed Hussain Jul 12 '17 at 16:38

0 Answers0