Skip to content

Commit

Permalink
Don't panic if the accept fails
Browse files Browse the repository at this point in the history
  • Loading branch information
imthatgin committed Apr 6, 2024
1 parent f8c6d35 commit 501fe70
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion wrapws/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,10 @@ func (ws *WebSocketServer) Serve(addr string) error {
func (ws *WebSocketServer) acceptFunc(w http.ResponseWriter, req *http.Request) {
conn, err := websocket.Accept(w, req, ws.options)
if err != nil {
ws.handler.OnError(req.Context(), nil, err)
return
}

if conn == nil {
return
}

Expand Down

0 comments on commit 501fe70

Please sign in to comment.