Skip to content

WebSocket fails to trigger on_load callback after long disconnections #1359

@nirben82

Description

@nirben82

Describe the bug
When a client's computer goes to sleep or loses its network connection for an extended period, the WebSocket drops and exhausts its maximum reconnect attempts. This leaves the channel permanently in a CLOSED state.

When the user wakes up the computer and interacts with the app (e.g., clicks a button), the dispatch method successfully spins up a new WebSocket connection to send the action. However, it only sends the UserEvent payload. Because an InitRequest is never sent on this newly established connection, the server processes the user event but completely skips the on_load lifecycle callback.

To Reproduce

  1. Allow CloudRun/Gunicorn timeout to be reach when the computer is not connected to the internet.
  2. Reconnect to internet
  3. Go back to the open tab and invoke a callback that requires the on_load to be run (e.g. session initialization code)

Expected behavior
on_load should be invoked before user event callback.

Desktop System Info

  • OS: MacOs
  • Browser: Chrome

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions