Scenario: Open bot try a few commands. Close laptop. open again. Bot says unable to connect.
I figured that this is because web socket closed. Is there a way to keep it open?
Scenario: Open bot try a few commands. Close laptop. open again. Bot says unable to connect.
I figured that this is because web socket closed. Is there a way to keep it open?
This issue is not related to web sockets, per se, but to Direct Line and the general nature of web pages.
When you open a web page it is largely static, assuming it's an every day run-of-the-mill page. If you close your laptop and reopen it nothing about the page should really change because there is no "live" connection being maintained.
However, when you load a page hosting a bot using Web Chat a live connection is opened via Direct Line. If you close your laptop and reopen it, then that connection is severed. Without direction, Web Chat doesn't know how to (re-)establish the connection without the page being reloaded.
Look over the answer I posted here. It shows how you can setup Web Chat to persist conversations with a bot when a user refreshes a page and/or navigates away and returns. It does rely on sessionStorage()
for part of its implementation which means it will only persist for the current session. If the user fully closes and opens the window, then a new connection is created.
To maintain "sessions" even when the user closes the window would require a more robust solution.
Hope of help!