All docs

Docs · Channels

TCP

line-delimited JSON

The TCP head (--tcp-listen-addrs, default :5050) is the raw socket channel: one JSON object per line in, one response line out, connection held open.

Wire protocol

  • In: newline-delimited messages, up to 10 MB per line (over-limit lines are dropped). Each line becomes one event.
  • Out: by default, the merged envelope as one JSON line (_-prefixed fields stripped). A rule can write raw bytes instead via @server.write (base64-decoded on the way out), or close the connection with @server.hangup = true.
  • On accept, a connect event fires first (before any line) — rules can greet, gate by IP, or hang up. Then the read loop: line → message event → response, repeated until idle timeout or hangup.
  • Admission denials are written as a "<status> <reason>" line, then the connection closes.

Envelope fields

FieldMeaning
@tcp.listenerListener name (--tcp-listen-addrs=webhooks=:5050,iot=:5051; bare addresses are default)
@tcp.local.{ip,port}The address the client connected to — route on raw port without any ingress config
@client.ipPeer address
@client.bodyThe incoming line, base64-encoded

Named listeners are also routing keys: routing.md maps a listener name to a tenant/stack.

Timeouts

FlagDefaultGuards
--tcp-connect-resp-timeout3sThe connect event’s rule response
--tcp-resp-timeout10sEach message event’s rule response
--tcp-max-idle-timeout5sSilence between lines

Edit this page · View as markdown