Given we have a channel created in the dashboard, how can we allow a user to participate in the chat that is going on?
Is the user supposed to join the channel first? if user has not joined the channel, which endpoint do we use to register the user?
I used the following example, given the user is already registered via client.registerSession
const addToChannel = useCallback(async () => {
const repo = await channelRepo.joinChannel({
channelId,
type: ChannelType.Live
});
}, [channelId])
The response from above is ‘success’ however the member Count does not increase.
I couldn’t figure out how to make a user join the channel and get them ready for chat. I was able to get some users to chat but somehow it didn’t work for some users. Is there a proper documentation on how to get the user up and ready for chat?
1 Like
Hello @sijanshs
Let me answer your questions separately:
1. Is the user supposed to join the channel first?
To be able to observe the messages in a channel, a user must join the channel before hand. More on that in the documentation: https://docs.amity.co/chat/web/channels#channel-members
When a user joins a channel, they are able to observe and chat with other users in that channel. They are also automatically considered a member of that channel.
2. if user has not joined the channel, which endpoint do we use to register the user?
You can call the method ChannelRepository.joinChannel
to make a user join a channel.
3. The response from above is ‘success’ however the member Count does not increase.
We’ve been updating our sample applications to show the member count. You can find the sample application (both for React or Vue) in our usual open source sample app repository at GitHub - AmityCo/Amity-Social-Cloud-Web-Sample-Apps: Amity Social Cloud offers Chat and Social SDKs to streamline app development. Dive into our UI Kits and sample apps in our repositories to spark your creativity. To learn more, visit amity.co.
Note that in some cases you may experience a slight delay in the increase of the member count when other users than the current user are joining. The reason is that we buffer this value intentionally to avoid flooding your users with many join messages.