Skip to main content

TCP Multiplexing

One physical connection carries multiple logical streams (Yamux), reducing connection-setup overhead. Applies to tcp / websocket / kcp; QUIC has built-in multiplexing, so this setting has no effect.

Client and server tcpMux must match, or the handshake will fail.

Example: Enable

TCP multiplexing is enabled by default. When it is on, application heartbeats can stay off (heartbeatInterval / heartbeatTimeout = -1); dead connections are detected by multiplexing keepalive instead.

Server:

# orbien-server.toml
[transport]
tcpMux = true
muxKeepaliveSecs = 30

Client:

# orbien.toml
[transport]
tcpMux = true
muxKeepaliveSecs = 30

Example: Disable

When disabled, each control/data stream uses its own connection, so application heartbeats should be enabled.

Server:

# orbien-server.toml
[transport]
tcpMux = false
heartbeatTimeout = 90

Client:

# orbien.toml
[transport]
tcpMux = false
heartbeatInterval = 30
heartbeatTimeout = 90

If the client omits heartbeat settings, disabling tcpMux automatically sets heartbeatInterval=30 and heartbeatTimeout=90.

Client parameters

ParameterRequiredDefaultDescription
transport.tcpMuxNotrueEnable multiplexing; must match the server
transport.muxKeepaliveSecsNo30Multiplexing keepalive interval (seconds). Rust yamux has no native KeepAlive; when tcpMux=true and application heartbeats are off, a control-plane Ping is sent at this interval (equivalent keepalive)
transport.heartbeatIntervalNo-1 (mux on) / 30 (mux off)Application heartbeat interval (seconds); -1 disables it
transport.heartbeatTimeoutNo-1 (mux on) / 90 (mux off)Disconnect if no Pong is received within this many seconds; -1 disables it

Server parameters

ParameterRequiredDefaultDescription
transport.tcpMuxNotrueEnable multiplexing; must match the client
transport.muxKeepaliveSecsNo30Multiplexing keepalive interval (seconds). Rust yamux has no native KeepAlive; when tcpMux=true and application heartbeat timeout is off, interval×3 is used as the timeout for kicking a client that sends no Ping (symmetric with the client)
transport.heartbeatTimeoutNo-1 (mux on) / 90 (mux off)Kick the control connection if no client Ping is received within this many seconds; -1 disables application heartbeat timeout (when mux is on, the keepalive logic above is used instead)