Features to be included:
I tried to come up with a basic design but would like hear some more thoughts and understand how whatsapp actually works.
Here is my initial analysis:
Client Server architecture is preferrable than peer-to-peer for a messaging system.
For a simpler understanding consider two users: Mike and Rachel.
When Mike sends a message("Hi") to Rachel, the message is sent to the Whatsapp server.
Once message is received by the server it is pushed in a dedicated queue for Rachel. (To uniquely identify the queue, it can be created with the ID as mobile number)
Queue acts as a buffer storage to hold the data in case the targeted user is offline.
If Rachel is online(connected to the internet), Rachel's whatsapp client reads the messages from the respective queue.
If Rachel is offline the message stays in the queue.
Expected questions on this initial design: