Sendbird: Group channel not created properly

258 Views Asked by At

I am using SendBird javascript SDK for chat and trying to create a group channel through the following code:

export async function openOneToOneChannel(user1, user2) {
  try {
    if (!sb) {
      await createSBClient(user1.id);
    }
    let params = new sb.GroupChannelParams();
    params.isPublic = false;
    params.isEphemeral = false;
    params.isDistinct = true;
    params.addUserIds([user1.id, user2.id]);
    params.customType = '1-1';
    let channel = await sb.GroupChannel.createChannel(params)
    return channel;
  } catch (error) {
    console.log('openOneToOneChannelError', error);
  }
}

The code return channel object successfully but the channel contain only the initiator/sender as a member of the channel. It returns: … “joinedMemberCount”:1, “memberCount”:1, "members”:[1] …

rather it should create a channel and add the receiver as a member as well. The correct channel should have: … “joinedMemberCount”:2, “memberCount”:2, "members”:[2] …

Can you please let me know what can possibly go wrong here ?

0

There are 0 best solutions below