Closed betim closed 5 years ago
For upgrade connection:
var upgrader = websocket.FastHTTPUpgrader{}
func example(ctx *fasthttp.RequestCtx) {
err := upgrader.Upgrade(ctx, func(ws *websocket.Conn) {
defer ws.Close()
// .... your code
})
if err != nil {
if _, ok := err.(websocket.HandshakeError); ok {
log.Println(err)
}
return
}
}
Thanks for this. I could not find an example that explained it clearly and I think there should be one.
You could check examples directory, that in each example have a fasthttp directory to see how to use it
How do we upgrade a
*fasthttp.RequestCtx
??