sendPacket method
Sends a packet.
@param {String} packet type. @param {String} data. @param {Object} options. @param {Function} callback function. @api private
Implementation
void sendPacket({type, data, options, EventHandler? callback}) {
if ('closing' == readyState || 'closed' == readyState) {
return;
}
options = options ?? {};
options['compress'] = false != options['compress'];
var packet = {'type': type, 'data': data, 'options': options};
emit('packetCreate', packet);
writeBuffer.add(packet);
if (callback != null) once('flush', callback);
flush();
}