Skip to content

feature: Automatically reconnect the websocket connection on close#169

Open
kezz wants to merge 1 commit intomainfrom
feature/auto-reconnection
Open

feature: Automatically reconnect the websocket connection on close#169
kezz wants to merge 1 commit intomainfrom
feature/auto-reconnection

Conversation

@kezz
Copy link
Copy Markdown
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
Copy Markdown
Contributor

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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Member

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

@MiniDigger
Copy link
Copy Markdown
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