send method

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

Writes a packet payload.

@param {Object} packet @api private

Implementation

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

  if (shouldClose != null) {
    _logger.fine('appending close packet to payload');
    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});
  });
}