How to save Blackberry Alive socket connections in an instant messaging app

I am having trouble keeping a socket connection in my application for a long period. It seems to turn off after a short time (every 2 minutes), especially if it doesn't work.

It happens that I am writing an application with a chat function, and for this I need to save the Live connection socket for the life of my application. I already tried tricks such as a pinging server every minute, but then this represents a drain of (Blackberry) resources. Blackberry Push is not an option (since I have clients other than BB devices).

Please, does anyone know how I can solve this or still suggest another alternative way to do this?

[I am also interested in how instant messaging applications for mobile applications such as WhatsApp, Kiks, etc., manage to remove this without unnecessarily depleting resources (at least the Resource Monitor application does not cry)

+4
source share
2 answers

We found the same behavior with socket connections on several versions of BB OS. We tried to play with socket settings - timeout, timeout, etc. But we did not find anything reliable and efficient on all platforms.

So, we have completed the following configuration:

  • Devices with a push-keep socket open with a ping after switching the idle timeout to a click
  • Devices without push-up socket with the longest available ping

Case 2 is rare, and we chose the longest ping interval, which keeps the connection open. It does not work 100%, we saw that on some devices it still disconnects the connection. But we are carefully handling this case with the reopening of a new one.

Hope this helps. Success!

+1
source

Blackberry Push is not an option (since I have clients other than BB devices).

This complex, but popular application definitely takes advantage of BlackBerry push, as well as the push feature offered on all other mobile platforms. This is part of BlackBerryโ€™s โ€œtrueโ€ support, not just as an afterthought. The short answer for you is to use the BlackBerry push service.

+1
source

All Articles