Backend
Asynchronous RPC API
Considering the goal of delivering a modern protocol, RPC layer was treated as the most important part.
Key features:
traffic optimization: we work with deltas of state updates, compress traffic, use binary serialization;
durability: connectivity issues and application state changes (such as moving to background or unloading from memory) are handled in a nice way allowing to forget about any issues with notification delivery;
simplicity: whole API layer is very straightforward and consistent allowing third-party developers to easily familiarize with system;
backward compatibility: versioning mechanism enables rolling updates for client apps and allows us to support different functionality for specific client applications;
scalability: API was designed in a way allowing us to utilize modern development techniques and software stacks such as NoSQL, CQRS, event-driven design.
From the standpoint of the high-level component, the client and the server exchange messages inside a session. The session is attached to the client device (the application, to be more exact) rather than a specific connection. In addition, each session is attached to a user key ID by which authorization is actually accomplished.
Several connections to a server may be open; messages may be sent in either direction through any of the connections (a response to a query is not necessarily returned through the same connection that carried the original query, although most often, that is the case; however, in no case can a message be returned through a connection belonging to a different session).
User can connect to service using multiple devices and use them in a different way (read different chats, do video calls etc), while all devices’ state will be kept up to date. It is possible because of unique Update/Diff mechanism built-in into API. This feature allows to prioritize some events, deliver and process them on devices in a different manner, so user will never miss a call or new message even on weak connection.
Last updated
