Skip to content

Commit

Permalink
chore(x): expose a WrapConn to wrap a Gorilla conn
Browse files Browse the repository at this point in the history
  • Loading branch information
sbruens committed Jan 30, 2025
1 parent 5f6d095 commit 72643a6
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions x/websocket/endpoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,12 @@ func newEndpoint[ConnType net.Conn](urlStr string, sd transport.StreamDialer, ws
}, nil
}

// WrapConn wraps a [websocket.Conn] from the Gorilla library into a
// [transport.StreamConn].
func WrapConn(wsConn *websocket.Conn) transport.StreamConn {
return &gorillaConn{wsConn: wsConn}
}

type gorillaConn struct {
wsConn *websocket.Conn
writeErr error
Expand Down

0 comments on commit 72643a6

Please sign in to comment.