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
{{ message }}
This repository has been archived by the owner on May 24, 2023. It is now read-only.
Fiber version
"github.com/gofiber/fiber/v2"
"github.com/gofiber/websocket/v2"
Issue description
c := *websocket.Conn
c.Close() do not close connect and has not error return
Code snippet
app.Get("/ws", websocket.New(func(c*websocket.Conn) {
// When the function returns, unregister the client and close the connectiondeferfunc() {
unregister<-cc.Close()
}()
register<-cfor {
messageType, message, err:=c.ReadMessage()
iferr!=nil {
ifwebsocket.IsUnexpectedCloseError(err, websocket.CloseGoingAway, websocket.CloseAbnormalClosure) {
log.Println("read error:", err)
}
return// Calls the deferred function, i.e. closes the connection on error
}
ifmessageType==websocket.TextMessage {
// Broadcast the received messagebroadcast<-string(message)
} else {
log.Println("websocket message received of type", messageType)
}
}
}))
Fiber version
"github.com/gofiber/fiber/v2"
"github.com/gofiber/websocket/v2"
Issue description
c := *websocket.Conn
c.Close() do not close connect and has not error return
Code snippet
this is code from your example: https://github.com/gofiber/recipes/blob/master/websocket-chat/main.go..
u can call c.Close() immediately but websocket still alive
The text was updated successfully, but these errors were encountered: