Skip to content

Commit

Permalink
[fix] Remove the 'data' listener when the receiver emits an error
Browse files Browse the repository at this point in the history
  • Loading branch information
lpinca committed Jun 23, 2018
1 parent 6046a28 commit 307be7a
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/websocket.js
Expand Up @@ -693,6 +693,8 @@ function receiverOnDrain () {
function receiverOnError (err) {
const websocket = this[kWebSocket];

websocket._socket.removeListener('data', socketOnData);

websocket.readyState = WebSocket.CLOSING;
websocket._closeCode = err[constants.kStatusCode];
websocket.emit('error', err);
Expand Down

0 comments on commit 307be7a

Please sign in to comment.