Chat Membership
Tracking and counting members of chat rooms
Use Chat Room Memberships to track which users are permanent members of rooms, even when they're offline. That way users can leave the app, come back later, and still be a part of the same rooms that they were before. Being a member of a room is separate from being present in a room, which tracks whether or not someone is online.
Once someone joins a room, they are a member of that room until they leave it. Joining a room is useful because the list of room memberships can be maintained per-user and looked up across sessions and devices.
A user does not have to be a member of a room to enter it and send messages.
Adding Members
Members can be added to a room in a few ways:
- Someone can join a room on their own to become a member
- A new member can be added to the room by another member
- Someone can accept an invitation to become a member
Counting Members
The number of members is steady regardless of whether or not they're online. For example, member counts are useful for displaying the number of participants in a group chat, even if not everybody is online at the same time it can be helpful to understand who is part of the chat and how many people are in it.
Trying to count how many people are online in a chat room?Use the User Presence service to count how many people are online, show connection status indicators, and more.
Member Limits
Rooms can have an optional member limit which controls the maximum number of members a room can have. Once that limit is reached, new members can't be added.
Updated about 3 hours ago