Bytsolv

Engineering of WhatsApp

WhatsApp, the top messaging app with 2.5 billion users across 100+ countries, keeps its tech and data security under wraps. Uncover its secrets with us!

Ejas Muhammed

Ejas Muhammed

Founder & CEO

WhatsApp Architecture

The scale, the users, the bandwidth and more

WhatsApp is the most popular messaging app in the world, with over 2.5 billion active users and more than 5 billion downloads. It's used in over 100 countries.

Every day, people send over 100 billion messages on WhatsApp. In this case study, we'll explore how WhatsApp works and its technology. We'll learn about its system design, server setup, and how it handles so many users and messages.

We'll also find out about the programming languages and frameworks it uses and how it keeps user data secure. So, if you're curious about the world's top chat app, keep reading!

The tech stacks

WhatsApp uses a variety of programming languages for its front-end applications on different platforms:

  • Android: Java
  • iOS: Swift
  • Windows Phone: C#
  • Web app: JavaScript, HTML, CSS
  • Mac Desktop app: Swift and Objective-C
  • PC Desktop app: C, C#, and Java

Each platform has its specific language to create a native app for the best performance and user experience.

Indeed, one of WhatsApp's unique selling points (USP) is its intuitive native user experience (UX) across various platforms.

The tech behind encryption

WhatsApp indeed uses end-to-end encryption to ensure that only the sender and the recipient can read the message in plain text. Here's how it works:

  1. When you send a message, WhatsApp encrypts it using the Signal Encryption Protocol.
  2. The encrypted message is stored on WhatsApp's servers temporarily until it's delivered to the recipient.
  3. Upon delivery, the recipient's device uses a unique cryptographic key to decrypt the message, making it readable in plain text.

Throughout this entire process, WhatsApp does not have access to the content of your message. The Signal Encryption Protocol, developed by Open System Whispers, is a robust and open-source encryption protocol designed for secure communication in asynchronous messaging systems. This encryption technology ensures the privacy and security of WhatsApp messages, making it difficult for unauthorized parties to intercept or access the content.

Storing the messages

WhatsApp's approach to message storage is centered on user privacy and security. Here's how it works:

  1. No Permanent Server Storage: WhatsApp does not permanently store your chat history on its servers. Messages are retained on WhatsApp's servers until the recipient successfully receives the message or for a maximum of 30 days.
  2. End-to-End Encryption: Even during this temporary storage, WhatsApp's end-to-end encryption ensures that the content of your messages remains secure and unreadable by WhatsApp.
  3. Local Encrypted Backups: Your WhatsApp messages are primarily stored locally on your phone in the form of encrypted backups. These backups are kept on your device to ensure that you have access to your message history. They are encrypted to protect your data from unauthorized access.
  4. Server Storage Exception: Messages are stored on WhatsApp's servers only in cases where the recipient cannot receive the message (e.g., due to being offline or not having a WhatsApp account). In such situations, the message is temporarily stored on the server and automatically deleted after 30 days.

By following this approach, WhatsApp maintains a balance between ensuring message delivery and preserving user privacy. Your message data is primarily under your control, stored locally on your device, and protected with encryption. This design aligns with WhatsApp's commitment to user data security and privacy.

Replacing SMS was the goal?

WhatsApps wide range of features and advantages over traditional SMS messaging, making it a preferred choice for many users:

  1. Rich Media Sharing
  2. Read Receipts and Last Seen
  3. Reactions, Stickers and GIFs
  4. Groups
  5. Channels
  6. Contact Blocking (Reducing the spam)
  7. Archive Conversations

WA Business APIs: APIs has opened up new possibilities for businesses to engage with customers and send transactional and marketing messages through WhatsApp, creating a direct and effective marketing channel.

With these features and the widespread adoption of WhatsApp, it has indeed replaced or complemented traditional SMS for many people, offering a richer and more interactive communication platform.

Multi-device

WhatsApp’s multi-device capability was a most requested feature as the web version of the WhatsApp was limited in all use cases.

WhatsApp's Multi-Device Capability:

  • WhatsApp is introduced a limited public beta for a multi-device feature.
  • Users can now use WhatsApp on their phone and up to four other non-phone devices simultaneously.
  • End-to-end encryption and privacy are maintained across all devices.
  • WhatsApp's architecture has been redesigned to support this functionality.

Previous Architecture Limitations:

  • The old architecture relied on a smartphone as the primary device.
  • This resulted in slower performance and frequent disconnections.
  • Only one companion device could be operative at a time.

New Multi-Device System:

  • No longer requires a smartphone as the source of truth.
  • User data is securely synchronized across devices without relying on the phone.

Security Measures for Multiple Devices:

  • Each device now has its own identity key.
  • The server maintains a mapping between user accounts and device identities.
  • Security codes represent the combination of all device identities.
  • Automatic Device Verification streamlines identity verification.
  • Users have control over which devices are linked to their account.

Read more about the multi-device architecture on Meta’s engineering blog

Multiple accounts

WhatsApp introduced the capability to have two WhatsApp accounts logged in simultaneously. This feature is helpful for individuals who need to switch between accounts, like managing work and personal communications. It eliminates the need to log out each time, or carry two phones.

Towards Telegram?

It's interesting to note that WhatsApp's recent feature additions bear some resemblance to those in the Telegram app. While Telegram has a complex and feature-rich architecture, WhatsApp originally aimed to replace SMS.

Meta appears to be gradually enhancing the platform's architecture to provide a more feature-packed experience.

The goal seems to be to introduce more features without sacrificing the user experience (UX) that everyone is familiar with on WhatsApp. This includes recent additions like multiple device logins and multi-account logins, which are seen as positive signs for WhatsApp's future.

The balance between evolving the platform and ensuring that it remains the UX, is a great game to watch!