Skip to content

Send InitRequest on dead WebSocket to trigger on_load#1360

Merged
richard-to merged 1 commit intomesop-dev:mainfrom
nirben82:reconnect_dead_websocket
Mar 17, 2026
Merged

Send InitRequest on dead WebSocket to trigger on_load#1360
richard-to merged 1 commit intomesop-dev:mainfrom
nirben82:reconnect_dead_websocket

Conversation

@nirben82
Copy link
Contributor

Update the dispatch method to check if the underlying WebSocket is dead before firing a user event. If it is dead, the client:

  1. Queues the incoming UserEvent.
  2. Sends an InitRequest that both revives the connection and triggers on_load on the server.
  3. Allows the existing dequeueEvent logic to safely fire the queued user action once the server finishes its initialization stream.

Fixes #1359

Copy link
Collaborator

@richard-to richard-to left a comment

Choose a reason for hiding this comment

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

Overall looks good to me. Just one question which I left as a comment.

@nirben82 nirben82 force-pushed the reconnect_dead_websocket branch from 72a33f5 to 939ca54 Compare March 17, 2026 17:06
@richard-to richard-to merged commit 1346f59 into mesop-dev:main Mar 17, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

WebSocket fails to trigger on_load callback after long disconnections

2 participants