Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

WebSocket

Acts as a WebSocket server (consumer — listens for connections) or client (publisher — connects to a target URL). As a consumer it receives frames; as a publisher it sends them.

URL format

# Consumer (listen):   ws://<bind-address>
# Publisher (connect):  ws://host[:port]/path

ws:// (plain) and wss:// (TLS) are both accepted. For a consumer the URL is the listen address (e.g. ws://0.0.0.0:9000); for a publisher it is the target server URL.

Examples

Listen for WebSocket frames and forward them to Kafka, continuous:

mq-bridge-app copy \
  --from ws://0.0.0.0:9000 \
  --to kafka://kafka.local:9092?topic=ws-events

Only accept a specific path:

mq-bridge-app copy \
  --from ws://0.0.0.0:9000?path=/ingest \
  --to file:///data/ws.jsonl?format=json

Push a stream to a remote WebSocket server, continuous:

mq-bridge-app copy \
  --from redis://localhost:6379?stream=events \
  --to wss://feed.example.com/socket

Key options

OptionPurpose
pathConsumer-only: only upgrade requests whose URI path matches exactly are delivered.
message_id_headerConsumer-only: handshake header to read the message ID from (default message-id).
execution_modeConsumer-only: auto (default), direct_only, or routed.
backlogConsumer-only: TCP listen backlog for the accept socket (default 4096).
routed_queue_capacityConsumer-only: queue capacity for the routed adapter (default 100).

Full field list: reference/websocket.md.