UserProfile state persistent between users in bot v4

后端 未结 2 1133
野趣味
野趣味 2021-01-17 02:02

When I have two instances of the bot (can be two emulator windows or two browsers if I deploy the bot to Azure), the first name enter is persistent for all the other instanc

相关标签:
2条回答
  • 2021-01-17 02:36

    If you don't provide WebChat with a unique id for each conversation, it will reference the same data objects in storage. So to the resolve this issue, you should generate a random id for each user or conversation instance. See the code snippet below for an example.

    const userID = Date.now() + Math.random().toString(36);
    
    ...
    
    window.WebChat.renderWebChat({
    directLine: window.WebChat.createDirectLine({ token }),
    store,
    userID
    }, document.getElementById('webchat'));
    

    Hope this helps!

    0 讨论(0)
  • 2021-01-17 02:50

    Also check latest README.md of webchat WEBCHAT API reference It states

    If userID is not specified, it will default to a random user ID

    Might be more efficient.

    0 讨论(0)
提交回复
热议问题