mirror of
https://github.com/danbulant/discord.js
synced 2026-06-10 02:02:40 +00:00
log speeds
This commit is contained in:
parent
0711fae926
commit
9ce332563b
1 changed files with 12 additions and 0 deletions
12
index.js
12
index.js
|
|
@ -136,6 +136,8 @@ exports.Client.prototype.login = function( email, password ) {
|
||||||
|
|
||||||
var self = this;
|
var self = this;
|
||||||
|
|
||||||
|
var time = Date.now();
|
||||||
|
|
||||||
Internal.XHR.login( email, password, function( err, token ) {
|
Internal.XHR.login( email, password, function( err, token ) {
|
||||||
|
|
||||||
if ( err ) {
|
if ( err ) {
|
||||||
|
|
@ -147,6 +149,7 @@ exports.Client.prototype.login = function( email, password ) {
|
||||||
self.token = token;
|
self.token = token;
|
||||||
self.loggedIn = true;
|
self.loggedIn = true;
|
||||||
self.connectWebsocket();
|
self.connectWebsocket();
|
||||||
|
console.log("Took "+ (Date.now() - time) +" ms to login!");
|
||||||
}
|
}
|
||||||
|
|
||||||
} );
|
} );
|
||||||
|
|
@ -168,6 +171,8 @@ exports.Client.prototype.connectWebsocket = function( cb ) {
|
||||||
|
|
||||||
var self = this;
|
var self = this;
|
||||||
|
|
||||||
|
var time = Date.now();
|
||||||
|
|
||||||
this.websocket = new WebSocket( Endpoints.WEBSOCKET_HUB );
|
this.websocket = new WebSocket( Endpoints.WEBSOCKET_HUB );
|
||||||
this.websocket.onclose = function( e ) {
|
this.websocket.onclose = function( e ) {
|
||||||
self.triggerEvent( "disconnected", [ {
|
self.triggerEvent( "disconnected", [ {
|
||||||
|
|
@ -189,6 +194,9 @@ exports.Client.prototype.connectWebsocket = function( cb ) {
|
||||||
|
|
||||||
var data = dat.d;
|
var data = dat.d;
|
||||||
|
|
||||||
|
console.log("Took "+ (Date.now() - time) +" ms to get READY!");
|
||||||
|
time = Date.now();
|
||||||
|
|
||||||
setInterval( function() {
|
setInterval( function() {
|
||||||
webself.keepAlive.apply( webself );
|
webself.keepAlive.apply( webself );
|
||||||
}, data.heartbeat_interval );
|
}, data.heartbeat_interval );
|
||||||
|
|
@ -213,8 +221,10 @@ exports.Client.prototype.connectWebsocket = function( cb ) {
|
||||||
if ( cached >= toCache ) {
|
if ( cached >= toCache ) {
|
||||||
self.ready = true;
|
self.ready = true;
|
||||||
self.triggerEvent( "ready" );
|
self.triggerEvent( "ready" );
|
||||||
|
console.log("Took "+ (Date.now() - time) +" ms to prepare!");
|
||||||
}
|
}
|
||||||
} );
|
} );
|
||||||
|
console.log("-", x, Date.now() - time)
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if ( dat.t === "MESSAGE_CREATE" ) {
|
} else if ( dat.t === "MESSAGE_CREATE" ) {
|
||||||
|
|
@ -348,6 +358,8 @@ exports.Client.prototype.connectWebsocket = function( cb ) {
|
||||||
connDat.d.properties = Internal.WebSocket.properties;
|
connDat.d.properties = Internal.WebSocket.properties;
|
||||||
|
|
||||||
this.sendPacket( connDat );
|
this.sendPacket( connDat );
|
||||||
|
console.log("Took "+ (Date.now() - time) +" ms to open WS connection!");
|
||||||
|
time = Date.now();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue