dist/client/lance-gg.js
/**
     * Called upon transport close.
     *
     * @api private
     */
Called upon transport close.
@api private
Called upon transport close . @api private
onClose(reason, desc) {
      if (
        "opening" === this.readyState ||
        "open" === this.readyState ||
        "closing" === this.readyState
      ) {
        debug$3('socket close with reason: "%s"', reason);
        const self = this;
        clearTimeout(this.pingIntervalTimer);
        clearTimeout(this.pingTimeoutTimer);
        this.transport.removeAllListeners("close");
        this.transport.close();
        this.transport.removeAllListeners();
        this.readyState = "closed";
        this.id = null;
        this.emit("close", reason, desc);
        self.writeBuffer = [];
        self.prevBufferLen = 0;
      }
    }
onClose ( reason , desc ) { if ( "opening" === this . readyState || "open" === this . readyState || "closing" === this . readyState ) { debug$3 ( 'socket close with reason: "%s"' , reason ) ; const self = this ; clearTimeout ( this . pingIntervalTimer ) ; clearTimeout ( this . pingTimeoutTimer ) ; this . transport . removeAllListeners ( "close" ) ; this . transport . close ( ) ; this . transport . removeAllListeners ( ) ; this . readyState = "closed" ; this . id = null ; this . emit ( "close" , reason , desc ) ; self . writeBuffer = [ ] ; self . prevBufferLen = 0 ; } }
Called upon transport close.
Called upon transport close .
// clear timers // stop event from firing again for transport // ensure transport won't stay open // ignore further transport communication // set ready state // clear session id // emit close event // clean buffers after, so users can still // grab the buffers on `close` event