When reconnection triggers
Reconnection flow
- WebSocket closes with code 1005 or 1006
- SDK emits
reconnectStreamstate:"disconnected" - SDK emits state:
"reconnecting" - After a 5-second delay, SDK emits state:
"retrying"and reconnects to the signaling server - On success: SDK emits state:
"connected"and theplayStreamevent fires - On failure or if 60 seconds have elapsed since the first disconnect: SDK emits state:
"failed"with code4007
The 60-second reconnection window starts from the first disconnect. If the connection drops repeatedly within that window, each attempt still counts against the 60-second limit.
Listening for reconnection state
State values
| Status | Description |
|---|---|
"disconnected" | WebSocket closed. data.code and data.reason are available. |
"reconnecting" | Reconnection process initiated |
"retrying" | Reconnection attempt in progress (after 5-second delay) |
"connected" | Successfully reconnected and streaming again |
"failed" | Reconnection failed. data.code is 4007 when the 60-second window expires |
Disconnect codes and reasons
When the connection closes intentionally,data.reason may contain one of these messages:
| Reason | Description |
|---|---|
"Project Inactive" | The project is disabled in the dashboard |
"Worker Node Unavailable" | No available compute nodes |
"Application Not Found" | The appId doesn’t match any project |
"Application Error" | The UE application crashed or errored |
"Maximum Runtime Reached" | The session exceeded its time limit |
"No streamer connected" | No UE instance is running |
Parent window communication
The SDK also sends disconnect events to the parent window (useful when the stream is embedded in an iframe):Next steps
Connection lifecycle
Map the events fired during initial connection setup.
Queue system
Display queue position updates when UE instances are busy.