A session is one viewer connected to your stream. This page is the reference for what state a session is in at any moment, what happens when all your workers are busy, how AFK timeouts work, and how to handle disconnects.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.
Session states
The Web SDK exposes the session’s current state. Use it to drive your loading UI, queue position, and reconnect messaging.| State | Meaning |
|---|---|
requesting | Browser is connecting to Streampixel. |
queued | No worker free; the viewer is waiting in line. |
connecting | Worker assigned; stream is being set up. |
streaming | Stream is live; video and audio flowing. |
idle | Viewer has been inactive past the AFK warning threshold. |
disconnected | Session ended cleanly. |
failed | Session ended unexpectedly (network drop, app crashed, no worker). |
Queue system
When every worker in your project’s region is busy, new viewers wait in a queue. The Web SDK fires events with the viewer’s position so you can render a wait UI.Position updates flow to your UI
The Web SDK fires events whenever the viewer’s position improves. Show a queue UI with the current position.
AFK timeout
To free workers from idle viewers, Streampixel tracks the time since the viewer’s last input. After a configurable threshold the viewer sees a warning; if they don’t interact, the session ends.| Setting | Default | Notes |
|---|---|---|
| Warning timeout | 2 minutes of inactivity | Warning UI appears in the SDK. |
| Disconnect timeout | 30 seconds after warning | Session ends with an AFK disconnect. |
Disconnect codes
Sessions end with a code that tells you whether the disconnect was normal, the viewer’s choice, or a problem on your build/server.| Code | Meaning |
|---|---|
1000 | Normal closure. |
1001 | Going away (tab closed, browser quit). |
1006 | Abnormal closure (network drop, no close frame). |
4000 | Project disabled. |
4001 | No worker available. |
4002 | App not found. |
4003 | App unable to launch. |
4004 | Max runtime reached. |
4005 | Streamer not found. |
4006 | App crashed. |
4007 | Reconnection failed. |
Reconnection
The Web SDK has built-in reconnection for transient failures. On1006 and 4007, the SDK retries with exponential backoff until the viewer gives up or a connection succeeds. You can hook into reconnection events to render your own UI.
Reconnection is not guaranteed to land on the same worker — the new session may even be on a fresh worker, depending on availability.
4000–4006), reconnection alone won’t fix the problem. Surface a meaningful error to the viewer and, where appropriate, link to a status page or a “try again” button.
What ends a session
| Trigger | Code(s) | Notes |
|---|---|---|
| Viewer closes tab | 1001 | Normal end-of-session. |
| Network drop | 1006 | SDK reconnects automatically. |
| AFK timeout | 4004 | Configurable threshold. |
| All workers busy at start | 4001 | Viewer never reached streaming. |
| App crashed | 4006 | Build-side problem; check UE logs. |
| Project disabled | 4000 | Owner disabled the project from the dashboard. |
Next steps
Disconnect codes
Full code reference and recovery patterns.
Web SDK overview
Hook into session events from your frontend.
Configuring your project
Tune worker count, AFK timeouts, and more.
Codec settings
Pick the right codec for your audience and content.