Skip to content

Commit fac6433

Browse files
committed
mailbox: change Websocket close status
Javascript errors are thrown on websocket connection close if the StatusGoingAway code is used. Things work if the StatusNormalClosure code is used instead.
1 parent 6504dce commit fac6433

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

mailbox/client_conn.go

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -537,17 +537,25 @@ func (c *ClientConn) Close() error {
537537
if c.receiveSocket != nil {
538538
log.Debugf("sending bye on receive socket")
539539
returnErr = c.receiveSocket.Close(
540-
websocket.StatusGoingAway, "bye",
540+
websocket.StatusNormalClosure, "bye",
541541
)
542+
if returnErr != nil {
543+
log.Errorf("Error closing receive socket: %v",
544+
returnErr)
545+
}
542546
}
543547
c.receiveStreamMu.Unlock()
544548

545549
c.sendStreamMu.Lock()
546550
if c.sendSocket != nil {
547551
log.Debugf("sending bye on send socket")
548552
returnErr = c.sendSocket.Close(
549-
websocket.StatusGoingAway, "bye",
553+
websocket.StatusNormalClosure, "bye",
550554
)
555+
if returnErr != nil {
556+
log.Errorf("Error closing send socket: %v",
557+
returnErr)
558+
}
551559
}
552560
c.sendStreamMu.Unlock()
553561

0 commit comments

Comments
 (0)