onEvent method

void onEvent(
  1. dynamic packet
)

Called upon event packet.

@param {Object} packet object @api private

Implementation

void onEvent(packet) {
  List args = packet['data'] ?? [];
  if (null != packet['id']) {
    args.add(ack(packet['id']));
  }
  // dart doesn't support "String... rest" syntax.
  if (args.length > 2) {
    Function.apply(super.emit, [args.first, args.sublist(1)]);
  } else {
    Function.apply(super.emit, args);
  }
}