Suppress logging of common 'going away' websocket error.

This commit is contained in:
Patrick Fairbank
2020-08-07 19:22:32 -07:00
parent 1b810f7d80
commit 80da0a2445

View File

@@ -53,7 +53,8 @@ func (ws *Websocket) Close() error {
func (ws *Websocket) Read() (string, interface{}, error) {
var message Message
err := ws.conn.ReadJSON(&message)
if websocket.IsCloseError(err, websocket.CloseNoStatusReceived, websocket.CloseAbnormalClosure) {
if websocket.IsCloseError(err, websocket.CloseAbnormalClosure, websocket.CloseGoingAway,
websocket.CloseNoStatusReceived) {
// This error indicates that the browser terminated the connection normally; rewrite it so that clients don't
// log it.
return "", nil, io.EOF