wsbridge

package
v0.50.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 16, 2026 License: MIT Imports: 4 Imported by: 0

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 PumpFrames

func PumpFrames(ctx context.Context, src, dst *websocket.Conn) error

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

func RunProxy(ctx context.Context, a, b *websocket.Conn, onFrame func()) error

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.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL