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.

A session is one user connected to one streaming worker over a single WebRTC peer connection. It begins when the browser opens a WebSocket to signalling and ends when either side closes the connection. This page walks through the states a session moves through, what queueing and AFK timeouts do, and how to handle disconnects.

End-to-end flow

Session states

The Web SDK exposes the session’s current state. Use it to drive your loading UI, queue position display, and reconnection messaging.
StateMeaning
requestingBrowser is opening the WebSocket to signalling.
queuedNo worker free; user is waiting in the project’s queue.
connectingWorker assigned; WebRTC handshake (SDP + ICE) in progress.
streamingPeer connection open; video and audio flowing.
idleUser has been inactive past the AFK warning threshold.
disconnectedSession ended cleanly (user, server, or AFK timeout).
failedSession ended unexpectedly (e.g. 1006, app crashed, no worker available).

Queue system

When every worker in your project’s region is busy, new sessions enter a queue. The signalling server emits the user’s position so you can render a wait UI.
1

User opens stream

Session enters requesting, then queued if no worker is free.
2

Position updates flow to the SDK

The Web SDK fires events whenever your position improves. Show a queue UI with the current position.
3

Slot opens

The first user in the queue is promoted to connecting, and a worker is reserved for them.
Increase your project’s worker count to reduce queueing during peak traffic. See configuring your project.

AFK timeout

To free workers from idle users, Streampixel tracks the time since the last input event. After a configurable threshold the user sees a warning; if they don’t interact, the session is disconnected.
SettingDefaultNotes
Warning timeout2 minutes of inactivityWarning UI appears in the SDK.
Disconnect timeout30 seconds after warningSession ends with an AFK disconnect.
Both thresholds are configurable from project settings or the Web SDK initialization options. Disable AFK only if you have a clear reason — idle sessions hold an entire GPU worker.

Disconnect codes

Sessions end with a code that tells you whether the disconnect was normal, the user’s fault, or an app/server problem.
CodeMeaning
1000Normal closure.
1001Going away (tab closed, browser quit).
1006Abnormal closure (network drop, no close frame).
4000Project disabled.
4001No worker available.
4002App not found.
4003App unable to launch.
4004Max runtime reached.
4005Streamer not found.
4006App crashed.
4007Reconnection failed.
Full reference and recovery suggestions: disconnect codes.

Reconnection

The Web SDK has built-in reconnection for transient failures. On 1006 and 4007, the SDK retries with exponential backoff until the user 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 land on a fresh worker, depending on availability.
For app-level codes (40004006), reconnection alone won’t fix the problem. Surface a meaningful error to the user and, where appropriate, link to a status page or a “try again” CTA.

What ends a session

TriggerCode(s)Notes
User closes tab1001Normal end-of-session.
Network drop1006SDK reconnects automatically.
AFK timeout4004Configurable threshold.
Worker pool exhausted at start4001User never reached streaming.
App crashed4006Build-side problem; check UE logs.
Project disabled4000Owner 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.

Streaming basics

What’s flowing across the open peer connection.

How Streampixel works

Where signalling and workers fit in the architecture.