socketio/socket.io-parser

When there's an error in decoding a message, the resulting error will be ignored by Socket

divillysausages opened this issue · 0 comments

In index.js, if there's an error decoding a message for whatever reason (e.g. malformed JSON), then the method error() will be called, returning:

function error() {
  return {
    type: exports.ERROR,
    data: 'parser error'
  };
}

However, when it eventually gets to Socket, the message will be ignored as the nsp property doesn't matched (as it's not set):

Socket.prototype.onpacket = function (packet) {
  if (packet.nsp !== this.nsp) return;

Is this an oversight, or is there a way to get this event (emit it on the default namespace?)? From what I can tell Manager doesn't have a generic error event