How does whatsapp Keeps its eJabberd/XMPP server connected when the app is Closed?

2.2k views Asked by At

How does Whatsapp keep its connection to the socket when the app is totally closed off.

Does Whatsapp use GCM or APNS push to trigger the App to sync with the Ejabberd?? Some people say it always stay connected(I am pretty new to this) but i tested i rebooted my phone, clear ram, AppManager forced close Whatsapp, it still receives the messages. So wondering can you make code runs on the OS level to keep the connections when everythings closed? Or it just use the GCM for triggers?

Isnt the only connection the phone has is the Android GCM when no app is running in the background?

I am very confused, if Whatsapp does use XMPP protocol, how does the App stays connected to the server when it is totally closed out?

I have researched further, found Pubnub is running something similar with TCP or XMPP protocol and can research messages while the app in the background.... But NOT IOS. http://www.pubnub.com/knowledge-base/discussion/381/can-my-ios-app-receive-messages-while-inactive

It requires the APNS push to wake the app up first then to reestablish the connection. But how about Whatsapp? Seems like Appstore compliance problem? But AppStore allow many apps to run in the background, but doesnt it allow Pubnub or Apps that have a connection to stay alive in the background?

1

There are 1 answers

0
Mickaël Rémond On

To build a chat application on iOS, you will be disconnected after a few minutes in all case. What you have to do is to rely on Apple Push Notification service to let the user know new messages have been received.

It means that you have to make sure ejabberd is modified to be able to leverage push notification service and not only rely on XMPP connection being available to tell the user about new messages.