Now that we are getting closer and closer to a release of our realtime feature, I would like to guide any developer who would like to try this feature ahead of time to use our current development branch.

Please keep in mind that this is an alpha version and we do not recommend using realtime in production yet.

Setup The Development Branch

The easiest way to start your Appwrite server is by running our Docker installer tool from your terminal. Before running the installation command, make sure you have Docker CLI installed on your host machine. For this we have prepared ready to use images from the feat-265-realtime Branch.

docker run -it --rm \\
    --volume /var/run/docker.sock:/var/run/docker.sock \\
    --volume "$(pwd)"/appwrite:/usr/src/code/appwrite:rw \\
    --entrypoint="install" \\
    torstendittmann/appwrite:realtime --organization=torstendittmann

After this command finished, our Appwrite server should be running. We can confirm this by navigating to http://localhost.

<aside> 💡 If you run into any problems, please reach out on Discord.

</aside>

You can run the realtime branch with existing data from a previous 0.8.0 installation - but always be aware that this a a preview version and you should backup your data before.

Introduction

The new SDKs have 2 additional methods on top of the official SDKs:

The most important one for us will be the subscribe method. This method subscribes to Appwrite events and passes you the payload in realtime.

subscribe(channels, callback)

The first parameter channels, defines to what channels you want to listen. Either pass a single channel as a string or multiple with an array of strings.

Possible channels are:

The second parameter called callback expects a function that will be triggered on every server side event you passed as a channel. This function is called on every server-side update and passes the received payload as a single argument.

The object received in the subscribe callback will look like this:

Response from Realtime

<aside> 💡 Keep in mind, that the client will only receive updates to events he has read access to.

</aside>