-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Open
Description
Hello,
I am trying to replace fastHTTP/websocket with coder/websocket, as it has some features I need.
Currently I use the fastHTTP/websocket upgrader like so:
func websocketUpgradeHandler(ctx *fasthttp.RequestCtx) {
logger.Infof("Received WS request on %s", string(ctx.Path()))
// Upgrade the connection to a websocket.
err := websockets.Upgrader.Upgrade(ctx, func(conn *websocket.Conn) {
// Create a new WS connection object and give it the new WS connection.
wsConnection := &websockets.WSConnection{Conn: conn}
// Start the inbound WS worker goroutine.
wsConnection.WSInboundWorker()
})
if err != nil {
logger.Errorf("Failed to upgrade WS connection: %s", err)
}
}
There is a coder/websocket issue that says this is possible, via the ctx.Hijack. From what I can tell, ctx.Hijack simply exposes the underlying net.Conn. But I am unsure how to use this in conjunction with coder/websocket.
Thanks for any help!
Metadata
Metadata
Assignees
Labels
No labels