Getting to know Zulip’s real time sync system

Aastha
Outreachy
Published in
1 min readDec 25, 2017

Any application that lets the user interacts with the database on the frontend or lets the user make changes in the database from the frontend requires a system to broadcast those changes. For example, in Zulip, if you change the emojiset, all the emoticons in the messages need to be changes accordingle. Another example is if you send a new message, then all other browser tabs of that user must display that message. In Zulip, these sort of changes need to be sent to all the clients of the user.

Whenever a change that is made into the database needs to be broadcast-ed to the frontend, an event is sent using ‘send_event’ python function. It takes the payload of the event and the recipient of the event as arguments.

In the frontend, most of the events are handled in the JavaScript file ‘server_events_dispatch.js’. In this file you can add the code to handle the event and to make necessary UI updates.

So, this is a very basic idea of how the real time updates are done in Zulip. For more information, do read the Zulip’s documentation on this.

If you are new to Zulip, it is very easy to get started with Zulip. Checkout this link: https://github.com/zulip/zulip#getting-started.

You can also checkout some ‘good first issues’ for beginners and start contributing :)

--

--