From b636cda646a01ab645e77f8093c99574655313e2 Mon Sep 17 00:00:00 2001 From: NatureFreshMilk Date: Wed, 27 Mar 2019 15:12:21 +0100 Subject: [PATCH] print ws upgrade error --- server/web/ws.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/server/web/ws.go b/server/web/ws.go index d58fb5b..c5d17a6 100644 --- a/server/web/ws.go +++ b/server/web/ws.go @@ -9,6 +9,7 @@ import ( "sync" "github.com/gorilla/websocket" + "github.com/sirupsen/logrus" ) type WS struct { @@ -56,7 +57,15 @@ func (t *WS) OnEvent(eventtype string, o interface{}) { } func (t *WS) ServeHTTP(resp http.ResponseWriter, req *http.Request) { - conn, _ := upgrader.Upgrade(resp, req, nil) + conn, err := upgrader.Upgrade(resp, req, nil) + + if err != nil { + fields := logrus.Fields{ + "err": err, + } + logrus.WithFields(fields).Error("ws-upgrade") + + } id := rand.Intn(64000) ch := make(chan []byte)