ccf45d454c
Did some tweaking and maneuvering to make things work. This version will now show a "notice received" alert box -- lots of progress! Had to test with Java server, not Python server.
37 lines
760 B
JavaScript
37 lines
760 B
JavaScript
// 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 '';
|
|
}
|
|
}();
|
|
|