Redacted debugState for WebSocketConnection and DemandMatcher

This commit is contained in:
Tony Garnock-Jones 2014-08-25 13:01:49 -07:00
parent 10abaa1724
commit 52bdc2eb3c
2 changed files with 28 additions and 0 deletions

View File

@ -420,6 +420,20 @@ function DemandMatcher(projection, metaLevel, options) {
this.currentSupply = {};
}
DemandMatcher.prototype.debugState = function () {
return {
demandPattern: this.demandPattern,
supplyPattern: this.supplyPattern,
metaLevel: this.metaLevel,
demandLevel: this.demandLevel,
supplyLevel: this.supplyLevel,
demandSideIsSubscription: this.demandSideIsSubscription
// , currentDemand: this.currentDemand
// , currentSupply: this.currentSupply
};
};
DemandMatcher.prototype.boot = function () {
var observerLevel = 1 + Math.max(this.demandLevel, this.supplyLevel);
World.updateRoutes([sub(this.demandPattern, this.metaLevel, observerLevel),

View File

@ -38,6 +38,20 @@ function WebSocketConnection(label, wsurl, shouldReconnect) {
this.pingTimer = null;
}
WebSocketConnection.prototype.debugState = function () {
return {
label: this.label,
sendsAttempted: this.sendsAttempted,
sendsTransmitted: this.sendsTransmitted,
receiveCount: this.receiveCount,
wsurl: this.wsurl,
shouldReconnect: this.shouldReconnect,
reconnectDelay: this.reconnectDelay,
connectionCount: this.connectionCount,
activityTimestamp: this.activityTimestamp
};
};
WebSocketConnection.prototype.clearHeartbeatTimers = function () {
if (this.idleTimer) { clearTimeout(this.idleTimer); this.idleTimer = null; }
if (this.pingTimer) { clearTimeout(this.pingTimer); this.pingTimer = null; }