Documentation Index
Fetch the complete documentation index at: https://docs.reactor.inc/llms.txt
Use this file to discover all available pages before exploring further.
Reactor is the base class for every model on the platform. It speaks raw JSON over the wire: open a session, send commands by name, and receive generic message events.
Typed model SDKs like HeliosModel extend Reactor with named, schema-matched methods over the same wire protocol. See the SDK Reference overview for how the two layers relate, and the Model API Reference for the commands and events a specific model accepts.
Constructor
new Reactor()
Creates a client for the given model. Call connect() afterward to open the session.
Signature
The name of the model to connect to.
The API URL.
If
true, connects to a local runtime at http://localhost:8080. Ignores apiUrl.Example
Methods
connect()
Establishes a connection to the coordinator, waits for GPU assignment, and opens a WebRTC connection to the model.
Signature
Token for authentication. See Authentication.
Connection behavior options.
Maximum SDP polling attempts before giving up.
disconnect()
Closes the connection. Safe to call multiple times.
Signature
If
true, the session is kept alive on the server and can be resumed with reconnect(). If false, the session is terminated.reconnect()
Reconnects to an existing session after a recoverable disconnect. Requires an active sessionId from a previous connection.
Signature
Connection behavior options (e.g.
maxAttempts).sendCommand()
Sends a command to the model over the WebRTC data channel.
Signature
The command name. Must match a command defined on the model.
The command payload. Shape depends on the command.
Example
FileRef values from uploadFile() as parameters. See File Uploads for details.
uploadFile()
Uploads a file and returns a FileRef that can be passed into sendCommand().
Signature
The file to upload.
Custom filename. Defaults to
file.name for File objects, or "upload" for Blob objects.Example
Can only be called when the status is
"ready".requestClip()
Captures the last durationSeconds of the live session and resolves with a Clip.
Signature
How many seconds back from “now” to capture. Capped server-side (5 minutes by default).
Example
RecordingError on invalid input, timeout, or disconnection. See Recordings.
Can only be called when the status is
"ready".requestRecording()
Captures the entire session, from the start of recording up to “now”, and resolves with a Clip.
Signature
Example
requestClip() but covers the full session. See Recordings.
Can only be called when the status is
"ready".downloadClipAsFile()
Downloads a Clip as a single MP4. Triggers a browser download when filename is set, or returns the Blob when filename is null.
Signature
The clip to download.
Filename to save. Pass
null to skip the browser download and just receive the Blob.JWT to authenticate the request. Required against
https://api.reactor.inc. See Authentication.Cancels both the metadata fetch and the segment downloads.
Called after each segment completes. Use for progress UI.
Example
publishTrack()
Publishes a media track to the model. The track name must match a sendonly track declared in the model’s capabilities.
Signature
Track name. Must match a
sendonly track name from the model’s capabilities.A
MediaStreamTrack from getUserMedia(), getDisplayMedia(), etc.Example
unpublishTrack()
Stops publishing a track to the model.
Signature
The name of the track to stop publishing.
on()
Registers an event listener.
Signature
Example
off()
Removes an event listener.
Signature
getStatus()
Returns the current connection status.
Signature
"disconnected", "connecting", "waiting", or "ready".
getState()
Returns the current status and last error.
Signature
getSessionId()
Returns the current session ID, or undefined if not connected.
Signature
getLastError()
Returns the most recent error, or undefined if no errors have occurred.
Signature
getCapabilities()
Returns the model’s capabilities (tracks, commands, emission FPS), or undefined if not yet connected.
Signature
getSessionInfo()
Returns the full session response from the coordinator, or undefined if not connected.
Signature
getStats()
Returns the current WebRTC connection statistics, or undefined if not connected.
Signature