Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature: Automatically reconnect the websocket connection on close #169

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

kezz
Copy link
Member

@kezz kezz commented Jul 24, 2023

Quite simple, just recreate the websocket and reinitialize it whenever it closes. Unsure if this will have any janky side-effects, but seems to work okay.

Closes #165.

@rymiel
Copy link
Member

rymiel commented Jul 24, 2023

Shouldn't this need some sort of delay or debounce? Wouldn't it start spamming requests?

Comment on lines -501 to -502
val warning = document.element<HTMLTextAreaElement>("connection-lost-warning")
val inputBox = document.element<HTMLTextAreaElement>("input")
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should remove the HTML for this too

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This still makes sense to have in cases where, for example the user has lost internet connection altogether, where there should be some evidence that the reconnection is being attempted

@MiniDigger
Copy link
Member

I agree with rymiel, a set timeout or even better, exceptional backoff

@MiniDigger
Copy link
Member

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow for websockets to reconnect
4 participants