send method

  1. @override
void send(
  1. List packets
)
override

Writes a packet payload.

Implementation

@override
void send(List packets) {
  writable = false;

  if (shouldClose != null) {
    packets.add({'type': 'close'});
    shouldClose!();
    shouldClose = null;
  }

  var self = this;
  PacketParser.encodePayload(packets, supportsBinary: supportsBinary == true,
      callback: (data) {
    var compress = packets.any((packet) {
      var opt = packet['options'];
      return opt != null && opt['compress'] == true;
    });
    self.write(data, {'compress': compress});
  });
}