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

Method _onDrain

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

* Called on `drain` event * * @private

()

Source from the content-addressed store, hash-verified

675 * @private
676 */
677 private _onDrain() {
678 this.writeBuffer.splice(0, this._prevBufferLen);
679
680 // setting prevBufferLen = 0 is very important
681 // for example, when upgrading, upgrade packet is sent over,
682 // and a nonzero prevBufferLen could cause problems on `drain`
683 this._prevBufferLen = 0;
684
685 if (0 === this.writeBuffer.length) {
686 this.emitReserved("drain");
687 } else {
688 this.flush();
689 }
690 }
691
692 /**
693 * Flush write buffers.

Callers

nothing calls this directly

Calls 1

flushMethod · 0.95

Tested by

no test coverage detected