WebsocketNetConn wraps websocket.NetConn and returns a context that is tied to the parent context and the lifetime of the conn. Any error during read or write will cancel the context, but not close the conn. Close should be called to release context resources.
(ctx context.Context, conn *websocket.Conn, msgType websocket.MessageType)
| 842 | // during read or write will cancel the context, but not close the |
| 843 | // conn. Close should be called to release context resources. |
| 844 | func WebsocketNetConn(ctx context.Context, conn *websocket.Conn, msgType websocket.MessageType) (context.Context, net.Conn) { |
| 845 | ctx, cancel := context.WithCancel(ctx) |
| 846 | nc := websocket.NetConn(ctx, conn, msgType) |
| 847 | return ctx, &wsNetConn{ |
| 848 | cancel: cancel, |
| 849 | Conn: nc, |
| 850 | } |
| 851 | } |
no outgoing calls
no test coverage detected