0

Is there a way for the backend to detect the webchat disconnected (ie, user closed page, navigated away, browser quited)?

There seems to be no out-of-the-box event for it. We rolled our own event (store.dispatch({...})) and attached it to the beforeunload event, but since it sends a webrequest, thats not supported.

I was thinking about using navigator.sendBeacon, but that will end up with a lot of unwanted events since that should be used on onVisibilityChanged (thus, webchat can still be active, but on a hidden tab). It seems to me that more people would want to know if the enduser is still active.

Using Botframework

user1515791
  • 675
  • 4
  • 20
  • https://stackoverflow.com/questions/59978048/how-to-check-if-the-user-has-the-webchat-window-open – ranusharao Dec 17 '20 at 00:32
  • Thanks, but like i wrote, window.onbeforeunload = function() { const eventSendActivity = new Event( 'sendEventActivity' ); eventSendActivity.data = 'User left conversation'; window.dispatchEvent( eventSendActivity ); } is not supported for major browsers, as it does a http call, which is not allowed in beforeunload. – user1515791 Dec 17 '20 at 07:46

0 Answers0