简体   繁体   English

使用 twilio 对话的冲突错误反应?

[英]Conflict error using twilio conversations react?

I'm using Twilio conversations, First participant and second participant are OK我正在使用 Twilio 对话,第一个参与者和第二个参与者都可以

channelName is OK频道名没问题

Token is OK令牌没问题

The conversation of the user is shown on (the app with no problem) but on web I'm getting error below用户的对话显示在(没有问题的应用程序)上,但在 web 上我收到以下错误

Code >代码 >

    const onConversationJoined = (conversation) => {
      conversation.add(secondPerson.id).then(() => setConversation(conversation));
    };

    const onConversationFound = (conversation) => {
      if (conversation.status !== "joined") {
        conversation.join().then(onConversationJoined);
      } else {
        setConversation(conversation);
      }
      conversation.on("messageAdded", handleNewMessage);
      onConnected();
    };

    const onConversationNotFound = (client) => {
      client
        .createConversation({
          uniqueName: channelName,
        })
        .then(onConversationFound)
        .catch((e) => console.log(e, "error"));   << ERROR APPEAR HERE
    };

    if (token) {
      const client = new Client(token);
      client.on("stateChanged", (state) => {
        if (state === "initialized") {
          client
            .getConversationByUniqueName(channelName)
            // following line dont run..
            .then(onConversationFound)
            .catch(() => onConversationNotFound(client));
        }
      });
    }

Error > with code https://www.twilio.com/docs/api/errors/50353错误 > 代码https://www.twilio.com/docs/api/errors/50353

The error shown on console.log console.log 上显示的错误

Error: Conflict
    at Upstream._callee$ (upstream.ts:179:1)
    at tryCatch (regeneratorRuntime.js:86:1)
    at Generator._invoke (regeneratorRuntime.js:66:1)
    at Generator.next (regeneratorRuntime.js:117:1)
    at asyncGeneratorStep (asyncToGenerator.js:3:1)
    at _next (asyncToGenerator.js:25:1) 'error'

Thanks!谢谢!

Twilio developer evangelist here. Twilio 开发人员布道师在这里。

It looks like you may have any Programmable Chat channels with the same name.看起来您可能有任何同名的可编程聊天频道。 When multiple participants are involved at roughly the same time, one may be creating the conversation and the other attempting to create it at the same time.当多个参与者大致同时参与时,一个可能正在创建对话,而另一个尝试同时创建它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM