MCPcopy
hub / github.com/socketio/socket.io / flush

Method flush

packages/engine.io-client/lib/socket.ts:697–712  ·  view source on GitHub ↗

* Flush write buffers. * * @private

()

Source from the content-addressed store, hash-verified

695 * @private
696 */
697 protected flush() {
698 if (
699 "closed" !== this.readyState &&
700 this.transport.writable &&
701 !this.upgrading &&
702 this.writeBuffer.length
703 ) {
704 const packets = this._getWritablePackets();
705 debug("flushing %d packets in socket", packets.length);
706 this.transport.send(packets);
707 // keep track of current length of writeBuffer
708 // splice writeBuffer and callbackBuffer on `drain`
709 this._prevBufferLen = packets.length;
710 this.emitReserved("flush");
711 }
712 }
713
714 /**
715 * Ensure the encoded size of the writeBuffer is below the maxPayload value sent by the server (only for HTTP

Callers 4

onOpenMethod · 0.95
_onDrainMethod · 0.95
_sendPacketMethod · 0.95
onTransportOpenMethod · 0.45

Calls 3

_getWritablePacketsMethod · 0.95
debugFunction · 0.85
sendMethod · 0.45

Tested by

no test coverage detected