Alongside the video stream, your app and the model exchange data over a real-time channel. You
control the model and receive feedback while it generates.
- Commands are instructions your app sends to the model. They control what the model generates
in real time.
- Messages are updates the model sends back to your app. They report state, signal events, or
deliver data.
For example, a video model might accept a set_prompt command to change what it generates, and
respond with periodic state messages reporting the current frame number and active prompt.
Commands
A command is a named action with a payload.
await reactor.sendCommand("set_prompt", { prompt: "a forest at dawn" });
import { useReactor } from "@reactor-team/js-sdk";
function PromptButton() {
const sendCommand = useReactor((s) => s.sendCommand);
return (
<button onClick={() => sendCommand("set_prompt", { prompt: "a forest at dawn" })}>
Set prompt
</button>
);
}
await reactor.send_command("set_prompt", {"prompt": "a forest at dawn"})
Every model defines its own commands with typed parameters. A prompt-driven model might expose
set_prompt; a model with camera controls might expose move or rotate. Command names, parameter
names, and types are all model-specific.
Prefer typed methods over string commands? Models with a published typed SDK (like
Helios or LingBot)
expose every command as a typed method with autocomplete, parameter hints, and compile-time
validation. No hand-written JSON, no string-typed command names.import { HeliosModel } from "@reactor-models/helios";
const helios = new HeliosModel();
await helios.setPrompt({ prompt: "a forest at dawn" });
See Two layers: base SDK and typed SDKs for the full picture.
Commands can only be sent when the connection is in the ready state.
Messages
Reactor models can send structured JSON messages to your app at any time during a session. Each model
defines its own message types.
reactor.on("message", (msg) => {
console.log(msg);
});
import { useReactorMessage } from "@reactor-team/js-sdk";
function MessageLogger() {
useReactorMessage((msg) => {
console.log(msg);
});
return null;
}
@reactor.on_message
def on_message(msg):
print(msg)
For the full list of commands and messages per model, see the
Model API Reference.