onPacket method

void onPacket(
  1. dynamic packet
)

Called with each packet. Called by Client.

@param {Object} packet @api private

Implementation

void onPacket(packet) {
  switch (packet['type']) {
    case eventValue:
      onEvent(packet);
      break;

    case binaryEventValue:
      onEvent(packet);
      break;

    case ackValue:
      onAck(packet);
      break;

    case binaryAckValue:
      onAck(packet);
      break;

    case disconnectValue:
      onDisconnect();
      break;

    case errorValue:
      emit('error', packet['data']);
  }
}