How to keep the chat session alive
Posted by on 15 May 2014 11:05 AM

How to keep the app alive in background?

QBChat instance has 90 seconds timeout. After a timeout the socket is closing. You need to keep up the connection by sending the (BOOL)sendPresence message to QBChat instance object. This will support the chat workflow. It is better to do this via timer. For example:

self.presenceTimer=[NSTimer scheduledTimerWithTimeInterval:30 target:[QBChat instance]
selector:@selector(sendPresence) userInfo:nil repeats:YES];

This way you show that user is online, can send and receive messages.

Comments (0)
Post a new comment
Full Name: