To connect to the server, Voce can use Volley and the OKHTTP library. To make simple requests you can see in the post HERE
In the case of Whatsapp that Voce spoke would risk saying that on their server they have a Google Cloud Messaging (GCM) implementation. GCM works so that whenever the user installs and runs the application for the first time, registers to the google server and the server returns a key that will identify the application on that device, then the app sends that key to the server(in this case that of Whatsapp) and keeps in the bank associated with the logged in user. Whenever another user decides to send a message to this user, it goes to the table that has the key record associated with the user and this same server sends a message to the GCM with the key and the message and google does the information Deliver as soon as the user or app is available.
More on the subject see the link HERE