For a well defeined chat application architecture, let us look
at the details. A chat consists of two major parts:
- Chat App or client portion, which is a desktop, web, or
smartphone chat application.
- Chat Server Engine, which is a pool of external servers
responsible for the chat operation. This is the place where all the
chat protocols come into play.
Both parts contain various components that communicate to each
other-
Chat Server Engine is a core of the chat architecture that
handles message delivery and dispatch. In our version of chat
architecture, it includes the following components:
- Chat REST API handles the tasks that are not connected directly
to message dispatch and delivery, such as user authentication,
changing of user settings, friends invitation, downloading sticker
packs, etc. The Chat App (the chat client part) communicates with
the Chat REST API via the Chat REST API Client Library.
- Chat WebSocket Server is responsible for transmitting messages
between users. The Chat App communicates with the Chat WebSocket
Server via the Chat WebSocket Client Library. This connection is
open two ways; that means users don’t have to make requests to the
server if there are any messages for them, they just get them right
away.
- Chat Media Storage Server is a pool of servers responsible for
storing user media files. The files are uploaded to them via the
Chat Media Storage Client Library.
Chat App is the other major part of the chat architecture, the
one that users directly interact with. It's split into three
separate root components:
- Chat Client Engine handles all of the communication with the
Chat Server Engine via its internal components: Chat REST API
Client Library, Chat WebSocket Client Library and Chat Media
Storage Client Library. It also comprises the Chat Push Message
Handler that deals with push notifications.
- Chat UI displays data to users via its widgets: Chat Contact
List UI, Chat Dialog UI, Chat Push Message Widget—extension for
mobile apps that allow for replying to messages without opening the
app and Chat Internal Notification Widget—a widget that pops up at
the top of the screen while the user is chatting in a dialog and
notifies about the incoming message in another dialog.
- Chat Device Storage is an internal database (read: your device
storage), which stores messages and files so that users can access
them offline. Its internal component, Chat Media Cache, gets media
files from the Chat Media Storage and stores them on the device so
that the user can access them anytime without having to reach the
Chat Media Storage every time.
WA underlying architecture is LYME/LYCE, except for the Linux
part. WA started from Ejabberd, an open source Jabber/XMPP instant
messaging server written in Erlang. It used XMPP
(eXtensible Messaging and Presence Protocol). That’s a protocol
that handles a message delivery system.
Ejabberd server is based on a set of pluggable modules that
enable features like:
- One-on-one messaging
- Store and forward (offline messages)
- Contact List and presence
- Group chat – Multi-User Chat (MUC)
- Message archive Management (MAM)
- Personal event protocol (PEP) and typing indicator
- Privacy settings, simple blocking extensions