Fix immediate fallback to long poll when websocket connection is lost #6208
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When a browser client loses its web socket connection to the server, I noticed that it immediately falls back to long poll without respecting the
longPollFallbackMs
delay.This causes all connected browser clients to fall back to long poll when restarting an Elixir server, instead of attempting to reconnect to a new web socket as expected.
I have added a failing test and a potential fix.
I am not sure that the implementation of the fix is the best so I would appreciate some insight on the issue before diving deeper into a better solution.
In this image you can see that I set the

longPollFallbackMs
to 5500 msThis image shows the client immediately falling back to long poll instead of waiting the 5500ms for a web socket connection.

Thanks for your consideration!