microsoft/BotFramework-DirectLineJS

networkInformation: Switching network type, then switching back again, results in RECONNECT_REJECTED

Opened this issue · 1 comments

Version: v0.15.5

Steps to reproduce:

  1. Within the networkInformation object, set the type to "wifi". Wait for connection to resume as expected.
  2. Within the networkInformation object, set the type to "cellular". Wait for connection to resume as expected.
  3. Within the networkInformation object, set the type to "wifi".

Then, Observe:

  1. After attempting a reconnection to "wifi" for the second time, a DIRECT_LINE/RECONNECT_REJECTED error is thrown, with a payload of: Error: Failed to reconnect. DirectLineJS returned 4.\n at reconnectSaga$
  2. The webchat ui is disabled, while displaying an "Unable to Connect" error message.

Hi @miketrexler,

DirectLineJS ASE adapter (a.k.a. DLASE) will reconnect up to 3 times. When a stable connection is detected, it will reset the retry counter back to 3.

DLASE consider the connection is stable if the connection did not close within a minute after the connection is established.

In other words, if connection is flaky and it keeps reconnecting quickly. Despite there maybe successful connection in between, it may fail to reconnect after 3 times.

I am open to suggestions on how the reconnect can be customized (retry times, backoff, stabilization, etc.) Currently, it is hardcoded here.