Advice and answers from the Realtime Team

Indeed, presence data can take up to 45 seconds to update. If your use case requires real-time presence updates (a few milliseconds after the presence event occurred), you must use the announcement channels.

Announcement channels are used to announce client events such as a new client connection, a new channel subscription, a client disconnection, among others. These channels behave like regular pub/sub channels, you simply subscribe them. The only difference to other channels in your app is that only Realtime servers will publish on them, as soon as they aware of the presence event.

So, the fastest way of knowing a user as entered your chat room is subscribing the ortcClientSubscribed announcement channel. The event will contain the channel subscribed and the metadata of the connection subscribing it. Save the user id or similar in the connection metadata property and it becomes straight forward to know who has entered the chat.

The current best-practice is subscribing these announcement channels in some "always-on" server-side process so you can handle all the presence state changes from your entire user base (see more about how to scale this approach at the "Scaling using sub-channels" section of http://messaging-public.realtime.co/documentation/starting-guide/announcement-channels.html)

When this server-side process starts you could use the Realtime presence API to get the current presence state for each channel and subscribe the announcement channels to receive the incremental updates thereafter. 

Did this answer your question?