Skip to main content

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.

An event emitter that reports reconnection state changes.

Methods

on(event, callback)

Listen for state change events.
ParameterTypeDescription
eventstringEvent name (always 'state')
callbackfunctionCalled with state data
reconnectStream.on('state', (data) => {
  console.log(data.status, data.code, data.reason);
});

Callback data

PropertyTypeDescription
statusstringCurrent state (see table below)
codenumberDisconnect/error code (only on disconnected and failed states)
reasonstringDisconnect reason (only on disconnected state)

State values

StatusDescription
"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

When status is "disconnected", the reason field may contain:
ReasonDescription
"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

Auto-reconnection triggers only on WebSocket close codes 1005 and 1006. All other close codes display the disconnect overlay without attempting reconnection.
  • Reconnection window: 60 seconds from first disconnect
  • Retry delay: 5 seconds between attempts
  • If the window expires, state transitions to "failed" with code 4007

Next steps

Custom loading screen

Drive a loading screen from reconnection state changes.

Troubleshooting

Diagnose disconnect codes and reconnection failures.