pub struct BridgeConfig {
pub close: CloseFrame,
pub keepalive: Option<KeepAlive>,
pub control: Option<ControlReceiver>,
pub on_close: Option<CloseHook>,
pub on_ping: Option<ControlHook>,
pub on_pong: Option<ControlHook>,
}Expand description
Control-frame configuration and hooks for bridge_with /
serve_h2_with.
BridgeConfig::default reproduces plain bridge behaviour: wslay
auto-answers pings with pongs, a Normal Closure is sent on teardown, no
keepalive, and no hooks fire. All fields are opt-in.
Fields§
§close: CloseFrameClose frame this side sends when it starts the close (e.g. the peer / upstream reached EOF). Defaults to 1000 Normal Closure, empty reason.
keepalive: Option<KeepAlive>Server-initiated keepalive (ping-and-timeout). None disables it — send
your own pings via control_channel instead.
control: Option<ControlReceiver>Receiver from control_channel, to send control frames while running.
on_close: Option<CloseHook>Called once when the connection ends, with the close frame describing why: the peer’s Close, the keepalive-timeout close, the teardown close, or 1006 (Abnormal) if the transport dropped without a Close.
on_ping: Option<ControlHook>Called when a Ping is received (wslay has already auto-queued the Pong).
on_pong: Option<ControlHook>Called when a Pong is received.