An event emitter that reports reconnection state changes.Documentation Index
Fetch the complete documentation index at: https://docs.streampixel.io/llms.txt
Use this file to discover all available pages before exploring further.
Methods
on(event, callback)
Listen for state change events.
| Parameter | Type | Description |
|---|---|---|
event | string | Event name (always 'state') |
callback | function | Called with state data |
Callback data
| Property | Type | Description |
|---|---|---|
status | string | Current state (see table below) |
code | number | Disconnect/error code (only on disconnected and failed states) |
reason | string | Disconnect reason (only on disconnected state) |
State values
| Status | Description |
|---|---|
"connecting" | Initial connection or reconnection started |
"reconnecting" | WebSocket closed unexpectedly, reconnection process begun |
"retrying" | Actively attempting to reconnect (after 5-second delay) |
"connected" | Successfully reconnected and streaming |
"disconnected" | Connection lost. Check code and reason for details |
"failed" | Reconnection gave up. code = 4007 when 60-second window expires |
Disconnect reasons
Whenstatus is "disconnected", the reason field may contain:
| Reason | Description |
|---|---|
"Project Inactive" | Project disabled in dashboard |
"Worker Node Unavailable" | No compute nodes available |
"Application Not Found" | Invalid appId |
"Application Error" | UE application error |
"Maximum Runtime Reached" | Session time limit exceeded |
"No streamer connected" | No UE instance running |
Reconnection behavior
- Reconnection window: 60 seconds from first disconnect
- Retry delay: 5 seconds between attempts
- If the window expires, state transitions to
"failed"with code4007
Next steps
Custom loading screen
Drive a loading screen from reconnection state changes.
Troubleshooting
Diagnose disconnect codes and reconnection failures.