Status
Nakama users can set a status message when they connect and update it while they’re online.
Users can follow each other to be notified of status changes. This is ideal to know when their friends are online and what they’re up to.
The status is set for each connection, and is erased when the user disconnects. If the user is connected from multiple devices each one is allowed to have a different status.
Set a status
By default users have no status when they first connect, and will not appear online to their followers. To appear online the user must set a status.
A status can be as simple as a text message from the user to their followers or it can be a structured JSON string with complex information such as the real-time multiplayer match ID the user is currently in - so their friends can jump in and join them!
The status can be set and updated as often as needed with this operation.
Appear offline
If the user needs to appear offline or “invisible” they can do so by erasing their status. Their followers will receive the same status update as they would if the user disconnects.
Receive status updates
When a user updates their status all of their followers receive an event that contains both the old status and the new one. Clients register an event handler to be called when receiving a status update.
If a user is disconnected or appears offline, they will leave their previous status but there will be no corresponding new status.
Follow users
Users only receive status updates from those they follow. Users can follow anyone they’re interested in, but it’s common to follow a list of friends to see when they’re online and what they’re up to.
When following a set of users, the operation will immediately return the status of those that are online and have set a visible status.
Following a user is only active with the current session. When the user disconnects they automatically unfollow anyone they may have followed while connected.
Unfollow users
Unfollowing a set of users immediately stops the user from receiving any further status updates from them.