ws-server://
WebSocket server (RFC 6455). Accepts Upgrade: websocket
requests on a configurable host:port + path. For TLS, use
wss-server://. For client-side, use
ws:// / wss://.
URI shape
ws-server://host[:port][/path]?…
- Consumer: emits one Exchange per inbound frame from any connected client.
- Producer: writes back to the originating session (or, with
sendToAll=true, broadcasts to every connection registered against this endpoint).
Parameters
Common
Same as ws://: host, port, path, handshakeTimeout,
pingInterval, maxMessageSize, TLS keys.
Consumer
| Param |
Type |
Default |
Description |
allowedOriginPattern |
string |
— |
Go RE2 regex against the Origin handshake header. Mismatches → 403. |
allowOriginHeader |
boolean |
true |
Echo Origin in the upgrade response. |
fireWebSocketConnectionEvents |
boolean |
false |
Emit HelixWsEvent=onOpen/onClose/onError synthetic Exchanges on connection lifecycle. |
Producer
| Param |
Type |
Default |
Description |
sendToAll |
boolean |
false |
Broadcast to every connected client instead of the originating session. Per-message override via HelixWsSendToAll header. |
| Header |
Direction |
HelixWsConnectionKey |
Written by consumer (per-connection key); read by producer when targeting a single session |
HelixWsEvent |
Written by consumer |
HelixWsRemoteAddress |
Written by consumer |
HelixWsSendToAll |
Read by producer (per-message broadcast toggle) |
HelixWsPath |
Written by consumer |
YAML examples
workflows:
# 1. Echo server — reply to each inbound message.
- id: ws-echo-server
description: Accept WS connections on :8080 and echo each message back.
trigger:
uri: ws-server://0.0.0.0:8080/echo
steps:
- transform:
starlang: '"echo: " ++ str(body())'
- to: ws-server://0.0.0.0:8080/echo
# 2. Broadcast server — every inbound message goes to ALL connected clients.
- id: ws-broadcast-server
description: Chat broadcast.
trigger:
uri: ws-server://0.0.0.0:8080/chat
params:
allowedOriginPattern: "https://chat\\.example\\.com|http://localhost(:\\d+)?"
fireWebSocketConnectionEvents: "true"
steps:
- to: ws-server://0.0.0.0:8080/chat?sendToAll=true
# 3. Conditional broadcast via header.
- id: ws-conditional-broadcast
description: Broadcast only when the message starts with "ALERT:".
trigger:
uri: ws-server://0.0.0.0:8080/notifications
steps:
- set-header:
name: HelixWsSendToAll
starlang: 'starts_with(str(body()), "ALERT:")'
- to: ws-server://0.0.0.0:8080/notifications
# 4. CORS-restricted production server.
- id: ws-cors
description: Only accept connections from chat.example.com.
trigger:
uri: ws-server://0.0.0.0:8080/secure
params:
allowedOriginPattern: "^https://chat\\.example\\.com$"
maxMessageSize: "65536"
pingInterval: "30s"
steps:
- log:
message: "msg from ${headers.HelixWsRemoteAddress}: ${body}"
See also