docs/Cli/Bridge

bridge

Start the REST + WebSocket bridge server.

subway bridge [--port <port>] [--relay <host:port>]

Flags#

FlagDefaultDescription
--port <port>9002Listen port for REST + WebSocket
--relay <addr>relay.subway.dev:9000Relay to connect to

What it runs#

A single actix-web server serving:

  • REST/v1/send, /v1/call, /v1/broadcast, /v1/resolve/:name, /v1/health, /v1/stats, /v1/subscribe
  • WebSocket/ws endpoint for full-duplex per-session agents

Example#

# Start bridge on default port
subway bridge
 
# Custom port and relay
subway bridge --port 8080 --relay localhost:9000

Then use the REST API:

curl -X POST http://localhost:9002/v1/send \
  -H "Content-Type: application/json" \
  -d '{"to":"worker.relay","message_type":"task","payload":"hello"}'

Or connect via WebSocket:

const ws = new WebSocket("ws://localhost:9002/ws")

See REST API and WebSocket for full protocol details.