how to restart a connection to the bot using sdk v4 for node js

岁酱吖の 提交于 2019-12-11 23:53:19

问题


I am developing a bot using sdk v4 for node js and i want to end the current conversation and start new convesation when user click on a button. I tried await this.conversationState.clear(turnContext) to clear conversation data but there is no change in conversation Id. please suggest how to trigger conversationUpdate activity to restart the connection to the bot.


回答1:


Both the Bot Emulator and the Azure Portal Web Chat's contain a sort of restart button that clears the conversation history and generates a new conversation ID. This is accomplished by refreshing Web Chat.

Direct Line generates a new conversation ID every time the secret is exchanged for a token. If you are passing a Direct Line secret to Web Chat directly and letting Web Chat exchange it for a token, then all you must do to generate a new conversation ID is refresh the page or frame.

If you are storing the secret somewhere private (recommended) and exchanging it for a token yourself and passing the token to Web Chat, then just do that again to generate a new conversation ID.



来源:https://stackoverflow.com/questions/53844906/how-to-restart-a-connection-to-the-bot-using-sdk-v4-for-node-js

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!