summaryrefslogtreecommitdiff
path: root/plugins/Comet/updatetimeline.js
blob: 7b22445e304a9930a6bf87ece2ce6b554c425873 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
// update the local timeline from a Comet server
//

var updater = function()
{
     var _cometd;

     return {
          init: function(server, timeline)
          {
               _cometd = $.cometd; // Uses the default Comet object
               _cometd.setLogLevel('debug');
               _cometd.init(server);
               _cometd.subscribe(timeline, receive);
               $(window).unload(leave);
          }
     }

     function leave()
     {
          _cometd.disconnect();
     }

     function receive(message)
     {
          alert("Received notice.");
          var noticeItem = makeNoticeItem(message.data);
          var noticeList = $('ul.notices');
     }

     function makeNoticeItem(data)
     {
          return '';
     }
}();