lib/websocket.js
function receiverOnError(err) {
  const websocket = this[kWebSocket];

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

  websocket.readyState = WebSocket.CLOSING;
  websocket._closeCode = err[kStatusCode];
  websocket.emit('error', err);
  websocket._socket.destroy();
}
function receiverOnError(err) {
  const websocket = this[kWebSocket];

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

  websocket.readyState = WebSocket.CLOSING;
  websocket._closeCode = err[kStatusCode];
  websocket.emit('error', err);
  websocket._socket.destroy();
}
function receiverOnError ( err ) { const websocket = this [ kWebSocket ] ; websocket . _socket . removeListener ( 'data' , socketOnData ) ; websocket . readyState = WebSocket . CLOSING ; websocket . _closeCode = err [ kStatusCode ] ; websocket . emit ( 'error' , err ) ; websocket . _socket . destroy ( ) ; }
The listener of the `Receiver` `'error'` event.

@param {(RangeError|Error)} err The emitted error
@private
The listener of the Receiver error event .