Documentation
¶
Overview ¶
Package wsbridge bidirectionally forwards WebSocket frames between two connections. Frame-level forwarding: doesn't parse JSON-RPC. JSON-RPC envelope boundaries are preserved because each Read/Write pair transfers exactly one frame — never byte concatenation.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func KeepAlive ¶ added in v0.51.2
KeepAlive sends a ws ping on conn every interval until ctx is cancelled. Exported so the codex-exec-gateway /bridge and inbound handlers (which run their own custom pumps and don't go through RunProxy) can install the same anti-idle behavior.
func PumpFrames ¶
PumpFrames reads one frame at a time from src and writes the exact same (MessageType, payload) to dst. This preserves JSON-RPC envelope boundaries.
Returns nil when src closes cleanly; otherwise the underlying error.
func RunProxy ¶
RunProxy starts two pumps in parallel and returns when either side closes or errors. Both ws conns are left open for the caller to close. onFrame is called on every successfully read frame (from either direction); pass nil if no callback is needed.
A background ping is sent on `a` every keepAliveInterval to keep idle-killing middleboxes from severing the connection during long quiet periods (e.g. the LLM taking minutes to respond before any frame flows).
Types ¶
This section is empty.