You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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!
The text was updated successfully, but these errors were encountered:
In theory I guess it should be possible, but I have never seen it. It requires a http.ResponseWriter and http.Request as arguments. You can try to use use fasthttpadaptor.ConvertReques() to create the http.Request, but you'll have to write your own code to convert it to a http.ResponseWriter as well.
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: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 underlyingnet.Conn
. But I am unsure how to use this in conjunction withcoder/websocket
.Thanks for any help!
The text was updated successfully, but these errors were encountered: