代码之家  ›  专栏  ›  技术社区  ›  YaSh Chaudhary

sendbird错误-应首先建立连接

  •  2
  • YaSh Chaudhary  · 技术社区  · 7 年前

    我使用的是RN v0.46.4和sendbird v3.0.35

    我试图制作一个频道,但出现了错误:

    应首先连接错误代码:800101

    _chat(item){
    
      console.log(item);
    
      var userIds = [1, item.id];
      sb = new SendBird({appId: APP_ID});
        sb.connect(item.id, function(user, error) {
              console.log(user);
    
            })
    
    sb.GroupChannel.createChannelWithUserIds(userIds, true, item.firstname, function(createdChannel, error) {
        if (error) {
            console.error(error);
            return;
        }
    
        console.log(createdChannel);
    });
    }
    
    1 回复  |  直到 7 年前
        1
  •  1
  •   Jin Ku    7 年前

    您应该在connect函数的回调中调用createChannel,这样我们就可以确保connect()已经成功。