Chat / JavaScript
Chat JavaScript v4
Chat JavaScript
Chat
JavaScript
Version 4
Home
/
Chat
/
JavaScript
/
User

Retrieve a list of users in a channel

Copy link

You can retrieve a list of participants who are currently online and receiving all messages from an open channel using the createParticipantListQuery() method. To retrieve a list of members in a group channel, call the members property.

Open channel

Copy link
const query = channel.createParticipantListQuery();

const users = await query.next();

Group channel

Copy link
channel.members;

Members of a group channel are automatically updated when a user is online. But when a user is disconnected from the Sendbird server and then reconnected, you should call the refresh() method to update the user's group channels with the latest information. See refresh all data related to a group channel for the sample code.