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 connection
defer func() {
unregister <- c
c.Close()
}()
register <- c
for {
messageType, message, err := c.ReadMessage()
if err != nil {
if websocket.IsUnexpectedCloseError(err, websocket.CloseGoingAway, websocket.CloseAbnormalClosure) {
log.Println("read error:", err)
}
return // Calls the deferred function, i.e. closes the connection on error
}
if messageType == websocket.TextMessage {
// Broadcast the received message
broadcast <- 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