godjjchrome/js/tmi.js
// Send a ping to the server..
Send a ping to the server
Send a ping to the server
function ping() {
        var _this18 = this;
        return this._sendCommand(this._getPromiseDelay(), null, "PING", function (resolve, reject) {
            _this18.latency = new Date();
            _this18.pingTimeout = setTimeout(function () {
                if (_this18.ws !== null) {
                    _this18.wasCloseCalled = false;
                    _this18.log.error("Ping timeout.");
                    _this18.ws.close();
                    clearInterval(_this18.pingLoop);
                    clearTimeout(_this18.pingTimeout);
                }
            }, _.get(_this18.opts.connection.timeout, 9999));
            _this18.once("_promisePing", function (latency) {
                resolve([parseFloat(latency)]);
            });
        });
    }
function ping ( ) { var _this18 = this ; return this . _sendCommand ( this . _getPromiseDelay ( ) , null , "PING" , function ( resolve , reject ) { _this18 . latency = new Date ( ) ; _this18 . pingTimeout = setTimeout ( function ( ) { if ( _this18 . ws !== null ) { _this18 . wasCloseCalled = false ; _this18 . log . error ( "Ping timeout." ) ; _this18 . ws . close ( ) ; clearInterval ( _this18 . pingLoop ) ; clearTimeout ( _this18 . pingTimeout ) ; } } , _ . get ( _this18 . opts . connection . timeout , 9999 ) ) ; _this18 . once ( "_promisePing" , function ( latency ) { resolve ( [ parseFloat ( latency ) ] ) ; } ) ; } ) ; }
Send a ping to the server..
Send a ping to the server ..
// Send the command to the server and race the Promise against a delay.. // Update the internal ping timeout check interval.. // Received _promisePing event, resolve or reject..