Chapter 19. Designing a Chat Application
In Chapter 6, we explored multiple networking protocols and communication mechanisms for building near real-time messaging platforms. Messaging applications are widely used across the globe. The application can be standalone, such as WhatsApp or Telegram, or it can be integrated as a feature inside social networking apps like LinkedIn or Instagram. In this chapter, we’ll learn how to design large-scale messaging applications to offer fast communication in near real time. We’ll also discuss the underlying architecture of WhatsApp messenger, which serves a huge number of concurrent users. Let’s begin with the system requirements of a chat application.
System Requirements
A messaging application can support a wide variety of features, but to keep it simple, we will choose to build a limited set of functionalities and skip features like voice and video calling. Let’s finalize the requirements to answer these questions:
- What kinds of communication are supported by the application?
-
The application offers one-to-one messaging, group messaging, and broadcast messaging. A broadcast is different from group messaging in that only a subset of users can send messages in the broadcast channel.
- What type of content will be supported by the application?
-
The application allows users to share text messages, images, videos, and documents. The next question that arises is whether there is a limit to the video file size. To avoid large media uploads, ...