Skip to main content

Module ws

Module ws 

Source
Expand description

WebSocket reverse proxy to Surfpool’s native WS endpoint.

As of Surfpool v1.1+ the upstream natively implements every subscription method Tidepool used to polyfill (signatureSubscribe, accountSubscribe, logsSubscribe with mentions filter, programSubscribe, slotSubscribe, plus the corresponding *Unsubscribe). We don’t add value by re-implementing them via HTTP polling — we just hide the fact that Surfpool’s WS listens on a different port (default 8900).

Per-client behavior: accept the upgrade, dial upstream, run two pumps (client → upstream, upstream → client), close cleanly when either side closes.

No reconnection — if upstream dies mid-session, the client sees the close and reconnects itself. Solana RPC clients are built for this.

No interception or rewriting. Future per-method intercepts (e.g. a Tidepool-specific tidepool_*Subscribe) would slot in here as a peek-before-forward step.

Replaces the polling polyfill that lived here through v0.1.x.

Structs§

WsState

Functions§

run_ws
Spawn the WS server on port. Forwards every connection to upstream_ws_url. Returns when the listener exits.