Mobile networks are known to cause issues with persistent connections. The following issues can happen:
- Some mobile data networks will not allow a TCP or Web Socket persistent connection over port 80. Connections should be avoided over port 80 instead use port 443 (secure) for Web Sockets and 1883 / 8883 for TCP. The InstaMsg library will take care of this automatically.
If a a connection is inactive for some time the network may drop the connection (PDP context). Typically the network will keep a PDP Context open for 1 to4 hours, without data transfer. The time limit varies from an operator to operator. The InstaMsg library takes care of this by sending a regular ping to the InstaMsg IoT server in absence of data for some time.
In case of poor or flaky network the device might consistently drop connections. This can be verified by analyzing the network strength for that device. In this case you will usually see the device creating multiple sessions during the day.