Endpoints
Execute stream (WebSocket)
Stream execution output over a persistent WebSocket connection with bidirectional messaging.
GET
Upgrades to a WebSocket connection for real-time bidirectional streaming of execution events.Documentation Index
Fetch the complete documentation index at: https://isol8.notdhruv.com/llms.txt
Use this file to discover all available pages before exploring further.
When to use WebSocket vs SSE
| Concern | WebSocket (/execute/ws) | SSE (/execute/stream) |
|---|---|---|
| Direction | Bidirectional | Server → client only |
| Transport | Single persistent TCP connection | HTTP response stream |
| Future interactivity | Supports stdin and signal messages (reserved) | No client-to-server messaging |
| Proxy compatibility | Requires WebSocket-capable proxy | Works through any HTTP proxy |
| Client support | Bun, modern browsers, Node 21+ | Any HTTP client |
Authentication
Authentication uses theAuthorization header on the WebSocket upgrade request, identical to all other authenticated endpoints.
Connection lifecycle
- Client sends HTTP upgrade request with
Authorizationheader. - Server validates auth and upgrades to WebSocket.
- Client sends an
executemessage with the code and options. - Server streams
stdout,stderr,exit, anderrorevents as JSON messages. - Server closes the connection with code
1000after execution completes.
Client → server messages (WsClientMessage)
Message type discriminator. One of
"execute", "stdin", or "signal".execute
Triggers code execution. Only one execution per WebSocket connection.
Execution request with
code and runtime.Optional execution options merged over server defaults.
poolStrategy and poolSize are always taken from server config.stdin (reserved)
Data to send to the running process’s stdin. Reserved for future interactive execution support.
signal (reserved)
Control signal to forward to the running process. Accepts
"SIGINT" or "SIGTERM". Reserved for future use.Server → client messages (WsServerMessage)
Server messages use the same StreamEvent format as the SSE endpoint.
Event kind:
stdout, stderr, exit, or error.Event payload. For
exit, this is the exit code as a string (e.g. "0").Close codes
| Code | Meaning |
|---|---|
1000 | Execution completed normally |
1003 | Client sent invalid JSON |
Error handling
- Invalid JSON: Server sends
{"type":"error","data":"Invalid JSON message"}then closes with code1003. - Unknown message type: Server sends
{"type":"error","data":"Unknown message type: ..."}(connection stays open). - Execution error: Server sends
{"type":"error","data":"..."}then closes with1000.
The WebSocket endpoint always uses ephemeral execution mode. Persistent sessions via
sessionId are not supported on WebSocket — use POST /execute for persistent sessions.