Having a list of online users at any given time

How can I create a list of the users that are online in the game?

Each user who joins a chat becomes a “presence” in the chat channel (unless they’ve joined as a “hidden” channel user). These presences keep information about which users are online.

A presence is made up of a unique session combined with a user ID. This makes it easy to distinguish between the same user connected from multiple devices in the chat channel.

The user who joins a chat channel receives an initial presence list of all other connected users in the chat channel. A callback can be used to receive presence changes from the server about users who joins and leaves. This makes it easy to maintain a list of online users and update it when changes occur.

Note, the server is optimized to only push presence updates when other users join or leave the chat.

You can find the code for this here https://heroiclabs.com/docs/social-realtime-chat/#list-online-users