From 52bdc2eb3c44bd17a60cfa74798599b10edef19b Mon Sep 17 00:00:00 2001 From: Tony Garnock-Jones Date: Mon, 25 Aug 2014 13:01:49 -0700 Subject: [PATCH] Redacted debugState for WebSocketConnection and DemandMatcher --- src/minimart.js | 14 ++++++++++++++ src/websocket-driver.js | 14 ++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/src/minimart.js b/src/minimart.js index f516b05..eb8192a 100644 --- a/src/minimart.js +++ b/src/minimart.js @@ -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), diff --git a/src/websocket-driver.js b/src/websocket-driver.js index 3ff5af9..ec74658 100644 --- a/src/websocket-driver.js +++ b/src/websocket-driver.js @@ -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; }