[Pkg-javascript-commits] [sockjs-client] 196/434: Fix #26 - emit heartbeat event when heartbeat happens.
Tonnerre Lombard
tonnerre-guest at moszumanska.debian.org
Wed Jan 8 00:47:13 UTC 2014
This is an automated email from the git hooks/post-receive script.
tonnerre-guest pushed a commit to branch master
in repository sockjs-client.
commit 315eae7d747f0be380c36a4928567e2950ca1b8a
Author: Marek Majkowski <majek04 at gmail.com>
Date: Fri Nov 18 14:32:10 2011 +0000
Fix #26 - emit heartbeat event when heartbeat happens.
---
lib/sockjs.js | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/lib/sockjs.js b/lib/sockjs.js
index 33eb67c..3dc1765 100644
--- a/lib/sockjs.js
+++ b/lib/sockjs.js
@@ -62,6 +62,12 @@ SockJS.prototype._dispatchMessage = function(data) {
that.dispatchEvent(new SimpleEvent("message", {data: data}));
};
+SockJS.prototype._dispatchHeartbeat = function(data) {
+ var that = this;
+ if (that.readyState !== SockJS.OPEN)
+ return;
+ that.dispatchEvent(new SimpleEvent('heartbeat', {}));
+};
SockJS.prototype._didClose = function(code, reason) {
var that = this;
@@ -127,7 +133,8 @@ SockJS.prototype._didMessage = function(data) {
var payload = JSON.parse(data.slice(1) || '[]');
that._didClose(payload[0], payload[1]);
break;
- case 'h':// heartbeat, ignore
+ case 'h':
+ that._dispatchHeartbeat();
break;
}
};
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/sockjs-client.git
More information about the Pkg-javascript-commits
mailing list