Skip to main content
Nullspace exposes several WebSocket channels:
ChannelUse
/v1/sandboxes/{id}/wsStreaming exec, PTY, and sandbox file-watch control messages.
/v1/volumes/{id}/wsDirect volume watch events.
/v1/lifecycle/wsLifecycle event stream.
/v1/monitor/wsFleet/sandbox monitor stream for snapshots, updates, metrics, processes, and errors.
/v1/sandboxes/{id}/access/desktop-viewer/wsManaged desktop viewer bridge.
sandbox.get_websocket_url(port)Signed public WebSocket access to a service running in the sandbox.
sandbox.get_host_info(22).websocket_urlLegacy signed SSH-over-WebSocket proxy URL for older port-22 fallback deployments.
Lifecycle and sandbox control channels send WebSocket Ping frames every 15 seconds and close after two missed Pong responses. PTY clients should treat a close without pty_exited as a transport disconnect. Default SSH access uses the certificate-backed relay through nullspace ssh and does not consume one of these WebSocket channels.

SDK examples

sandbox.commands.run(
    "for i in 1 2 3; do echo $i; sleep 1; done",
    shell=True,
    on_stdout=lambda data: print(data, end=""),
)
session = sandbox.pty.create_session()
session.send_input("pwd\n")
from nullspace import Lifecycle

lifecycle = Lifecycle()
subscription = lifecycle.subscribe(on_event=lambda event: print(event.operation))
subscription.stop()
lifecycle.close()
from nullspace import Monitor

monitor = Monitor()
subscription = monitor.subscribe(
    interval_ms=1000,
    include_processes=True,
    on_metrics=lambda event: print(event.metrics),
)
subscription.stop()

Public exposed-port WebSockets

info = sandbox.get_host_info(8080)
print(info.websocket_url)
The signed URL is scoped to the sandbox, port, and WebSocket transport. Missing or expired edge tokens fail before traffic reaches the sandbox service.

Monitor subscribe message

Custom clients send a monitor_subscribe message to /v1/monitor/ws:
{
  "type": "monitor_subscribe",
  "id": "monitor_1",
  "interval_ms": 1000,
  "include_processes": true
}
Server messages include snapshot, update, metrics, processes, and error payloads. Use SDK callbacks unless you need a non-Python client.

Full protocol

The longer repository protocol reference, including message shapes, lives at docs/product/reference/websocket-protocol.md.