[BUGFIX] websocket error handling

This commit is contained in:
Martin Geno 2017-11-17 20:38:53 +01:00
parent 9d60973ea1
commit c2c5666977
No known key found for this signature in database
GPG Key ID: F0D39A37E925E941
1 changed files with 3 additions and 4 deletions

View File

@ -1,8 +1,6 @@
package websocket
import (
"io"
"github.com/google/uuid"
log "github.com/sirupsen/logrus"
@ -106,10 +104,11 @@ func (c *Client) listenRead() {
default:
var msg Message
err := websocket.ReadJSON(c.ws, &msg)
if err == io.EOF {
if websocket.IsCloseError(err, websocket.CloseGoingAway) {
return
} else if err != nil {
log.Println(err, c.GetID())
log.Infof("error on reading %s: %s", c.GetID(), err)
return
} else {
c.handleInput(&msg)
}