WhatsApp References and backup

Putting everything together

So far, we have discussed each feature, including user connection with a server, sending messages and media files, group messages, and end-to-end encryption, individually. Let’s combine these features in a single illustration and summarise our design.

  • Each user is connected via Load Balancers with a WebSocket handler provided by the WebSocket server. The mapping between the WebSocket handler and a user is stored in the WebSocket Manager resides on top of the Redis cluster. A connection between users is established through WebSocket Manager. However, to reduce latency, WebSocket servers cache information stored in the WebSocket Manager, reducing traffic towards WebSocket Manager.

  • After a connection is established, users can send and receive messages via Message Service. If a user is offline, the messages are stored on the Mnesia cluster for a maximum duration of 30 days. When the user becomes online, the WebSocket Manager sends a signal to the Message Service which in turn sends the messages intended for the user.

  • Media files or documents are first stored on blob storage and then sent via Asset Service to the intended user. Moreover, frequently shared data is stored onto a CDN for better performance.

  • User Service maintains data of each user, including user ID, profile picture, status, the public key used for end-to-end encryption, and other relevant data.

  • Group Service maintains information about each group, including the number of users, users IDs, creation date, and other relevant data. Group Service and Group Handler are responsible for sending messages to a group via Kafka and Message Service.

With all these features, we have covered the functional requirements mentioned in the previous lesson, i.e., send and receive messages, group messages, and sending media files and documents.

In the next lesson, we will focus on evaluating our design and looking into the non-functional requirements.

Create a free account to access the full course.

By signing up, you agree to Educative's Terms of Service and Privacy Policy