What is the purpose of session.endConversation ()

I am developing a bot in node.js using Microsoft Bot Framework. As soon as my user completes their action with my bot; I'm calling session.endConversation()

. However, I'm not sure what it is. My guess when calling this code would be that it will clear the session data; therefore, if the user interacts with the bot again; they will, in fact, begin.

However, when I call endConversation (), the user data still exists:

    session.endConversation("Thank you for your business!");
    console.log("User Data:");
    console.log(session.userData);

      

enter image description here

The documentation simply says "ends the conversation" but does not describe what that really means.

I guess my question is, what does this function do and when you finish the conversation, what should be the approach to handling user conversation data?

+3


source to share


1 answer


According to this post :



As a result, when a conversation or dialogue has come to an end, it is best to be named endConversation

, endDialog

or endDialogWithResult

explicitly. endConversation

both clear the current dialog stack and flush all data stored in the session except for userData. Both endDialog

and endDialogWithResult

complete dialogue dialogData clean and manage the previous dialog box in the stack. In contrast endDialog

, endDialogWithResult

allows you to pass arguments to the previous dialog, which will be available in the second parameter of the first method in the waterfall (usually called the result).

+3


source







All Articles