summaryrefslogtreecommitdiff
path: root/plugins/Comet/cometupdate.js
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/Comet/cometupdate.js')
-rw-r--r--plugins/Comet/cometupdate.js30
1 files changed, 30 insertions, 0 deletions
diff --git a/plugins/Comet/cometupdate.js b/plugins/Comet/cometupdate.js
new file mode 100644
index 000000000..72cca004b
--- /dev/null
+++ b/plugins/Comet/cometupdate.js
@@ -0,0 +1,30 @@
+// update the local timeline from a Comet server
+//
+
+var CometUpdate = function()
+{
+ var _server;
+ var _timeline;
+ var _userid;
+ var _replyurl;
+ var _favorurl;
+ var _deleteurl;
+ var _cometd;
+
+ return {
+ init: function(server, timeline, userid, replyurl, favorurl, deleteurl)
+ {
+ _cometd = $.cometd; // Uses the default Comet object
+ _cometd.init(server);
+ _server = server;
+ _timeline = timeline;
+ _userid = userid;
+ _favorurl = favorurl;
+ _replyurl = replyurl;
+ _deleteurl = deleteurl;
+ _cometd.subscribe(timeline, function(message) { RealtimeUpdate.receive(message.data) });
+ $(window).unload(function() { _cometd.disconnect(); } );
+ }
+ }
+}();
+