It will need Message Queue to deal with that. But it will need server to do the most of things.
Because of WhatsApp is a chat app, it will produce large number of messages all the time.
Therefore, we can use Message Queue to store messages temporarily between client and server to solve when the network is wrong or device is off line(the same as Phone off).
As soon as the device is online, the Message Queue will send message to the mobile device.
You could have a look at RabbitMQ, it is the most widely deployed open source message broker. And there are many good discussions about using it in Google, you could search to check.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…