howdyai / botkit-starter-web

Botkit Anywhere - a starter kit for building a bot that lives in your website or app
https://botkit.ai
MIT License
113 stars 75 forks source link

WebSocket + Browser Refresh #26

Closed hwhelchel closed 6 years ago

hwhelchel commented 6 years ago

If I've loaded of Botkit Starter Web locally or in the cloud and refresh the browser, the client.js sends down a hello or a welcome_back event.

In the ingest middleware in Web.js when finding the conversation there is a section that changes the event to reconnect instead of keeping it as welcome_back.

As an end user, I think it would make more sense for welcome_back to pass through if the reconnect is happening due to a page refresh by the client.

If the network is intermittent and disconnects and then reconnects then in that case a reconnect event makes sense.

Is there a clean way to distinguish between these two types of disconnects?

A voluntary client page refresh vs. network connectivity issues?