log speeds

This commit is contained in:
hydrabolt 2015-08-15 23:03:23 +01:00
parent 0711fae926
commit 9ce332563b

View file

@ -136,6 +136,8 @@ exports.Client.prototype.login = function( email, password ) {
var self = this;
var time = Date.now();
Internal.XHR.login( email, password, function( err, token ) {
if ( err ) {
@ -147,6 +149,7 @@ exports.Client.prototype.login = function( email, password ) {
self.token = token;
self.loggedIn = true;
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 time = Date.now();
this.websocket = new WebSocket( Endpoints.WEBSOCKET_HUB );
this.websocket.onclose = function( e ) {
self.triggerEvent( "disconnected", [ {
@ -189,6 +194,9 @@ exports.Client.prototype.connectWebsocket = function( cb ) {
var data = dat.d;
console.log("Took "+ (Date.now() - time) +" ms to get READY!");
time = Date.now();
setInterval( function() {
webself.keepAlive.apply( webself );
}, data.heartbeat_interval );
@ -213,8 +221,10 @@ exports.Client.prototype.connectWebsocket = function( cb ) {
if ( cached >= toCache ) {
self.ready = true;
self.triggerEvent( "ready" );
console.log("Took "+ (Date.now() - time) +" ms to prepare!");
}
} );
console.log("-", x, Date.now() - time)
}
} else if ( dat.t === "MESSAGE_CREATE" ) {
@ -348,6 +358,8 @@ exports.Client.prototype.connectWebsocket = function( cb ) {
connDat.d.properties = Internal.WebSocket.properties;
this.sendPacket( connDat );
console.log("Took "+ (Date.now() - time) +" ms to open WS connection!");
time = Date.now();
}
}