--- /dev/null
+<?php
+/**
+ * Laconica, the distributed open-source microblogging tool
+ *
+ * Plugin to do "real time" updates using Comet/Bayeux
+ *
+ * PHP version 5
+ *
+ * LICENCE: This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * @category Plugin
+ * @package Laconica
+ * @author Evan Prodromou <evan@controlyourself.ca>
+ * @copyright 2009 Control Yourself, Inc.
+ * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
+ * @link http://laconi.ca/
+ */
+
+if (!defined('LACONICA')) {
+ exit(1);
+}
+
+/**
+ * Plugin to do realtime updates using Comet
+ *
+ * @category Plugin
+ * @package Laconica
+ * @author Evan Prodromou <evan@controlyourself.ca>
+ * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
+ * @link http://laconi.ca/
+ */
+
+class CometPlugin extends Plugin
+{
+ var $server = null;
+
+ function __construct($server=null)
+ {
+ $this->server = $server;
+
+ parent::__construct();
+ }
+
+ function onEndShowScripts($action)
+ {
+ $timeline = null;
+
+ switch ($action->trimmed('action')) {
+ case 'public':
+ $timeline = '/timelines/public';
+ break;
+ default:
+ return true;
+ }
+
+ $action->element('script', array('type' => 'text/javascript',
+ 'src' => common_path('plugins/Comet/jquery.comet.js')),
+ ' ');
+ $action->elementStart('script', array('type' => 'text/javascript'));
+ $action->raw("var _timelineServer = \"$this->server\"; ".
+ "var _timeline = \"$timeline\";");
+ $action->elementEnd('script');
+ $action->element('script', array('type' => 'text/javascript',
+ 'src' => common_path('plugins/Comet/updatetimeline.js')),
+ ' ');
+ return true;
+ }
+
+ function onEndNoticeSave($notice)
+ {
+ $this->log(LOG_INFO, "Called for save notice.");
+
+ $timelines = array();
+
+ // XXX: Add other timelines; this is just for the public one
+
+ if ($notice->is_local ||
+ ($notice->is_local == 0 && !common_config('public', 'localonly'))) {
+ $timelines[] = '/timelines/public';
+ }
+
+ if (count($timelines) > 0) {
+ // Require this, since we need it
+ require_once(INSTALLDIR.'/plugins/Comet/bayeux.class.inc.php');
+
+ $json = $this->noticeAsJson($notice);
+
+ $this->log(LOG_DEBUG, "JSON = '$json'");
+
+ // Bayeux? Comet? Huh? These terms confuse me
+ $bay = new Bayeux($this->server);
+
+ foreach ($timelines as $timeline) {
+ $this->log(LOG_INFO, "Posting notice $notice->id to '$timeline'.");
+ $bay->publish($timeline, $json);
+ $this->log(LOG_DEBUG, "Done posting notice $notice->id to '$timeline'.");
+ }
+
+ $bay = NULL;
+ }
+
+ $this->log(LOG_DEBUG, "All done.");
+ return true;
+ }
+
+ function noticeAsJson($notice)
+ {
+ // FIXME: this code should be abstracted to a neutral third
+ // party, like Notice::asJson(). I'm not sure of the ethics
+ // of refactoring from within a plugin, so I'm just abusing
+ // the TwitterApiAction method. Don't do this unless you're me!
+
+ require_once(INSTALLDIR.'/lib/twitterapi.php');
+
+ $act = new TwitterApiAction('/dev/null');
+
+ $arr = $act->twitter_status_array($notice, true);
+ return $arr;
+ }
+
+ // Push this up to Plugin
+
+ function log($level, $msg)
+ {
+ common_log($level, get_class($this) . ': '.$msg);
+ }
+}
--- /dev/null
+<?php
+/*
+ *
+ * Phomet: a php comet client
+ *
+ * Copyright (C) 2008 Morgan 'ARR!' Allen <morganrallen@gmail.com> http://morglog.alleycatracing.com
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+class Bayeux
+{
+ private $oCurl = '';
+ private $nNextId = 0;
+
+ public $sUrl = '';
+
+ function __construct($sUrl)
+ {
+ $this->sUrl = $sUrl;
+
+ $this->oCurl = curl_init();
+
+ $aHeaders = array();
+ $aHeaders[] = 'Connection: Keep-Alive';
+
+ curl_setopt($this->oCurl, CURLOPT_URL, $sUrl);
+ curl_setopt($this->oCurl, CURLOPT_HTTPHEADER, $aHeaders);
+ curl_setopt($this->oCurl, CURLOPT_HEADER, 0);
+ curl_setopt($this->oCurl, CURLOPT_POST, 1);
+ curl_setopt($this->oCurl, CURLOPT_RETURNTRANSFER,1);
+
+ $this->handShake();
+ }
+
+ function __destruct()
+ {
+ $this->disconnect();
+ }
+
+ function handShake()
+ {
+ $msgHandshake = array();
+ $msgHandshake['channel'] = '/meta/handshake';
+ $msgHandshake['version'] = "1.0";
+ $msgHandshake['minimumVersion'] = "0.9";
+ $msgHandshake['supportedConnectionTypes'] = array('long-polling');
+ $msgHandshake['id'] = $this->nNextId++;
+
+ curl_setopt($this->oCurl, CURLOPT_POSTFIELDS, "message=".urlencode(str_replace('\\', '', json_encode(array($msgHandshake)))));
+
+ $data = curl_exec($this->oCurl);
+
+ if(curl_errno($this->oCurl))
+ die("Error: " . curl_error($this->oCurl));
+
+ $oReturn = json_decode($data);
+
+ common_debug(print_r($oReturn, true));
+
+ if (is_array($oReturn)) {
+ $oReturn = $oReturn[0];
+ }
+
+ $bSuccessful = ($oReturn->successful) ? true : false;
+
+ if($bSuccessful)
+ {
+ $this->clientId = $oReturn->clientId;
+
+ $this->connect();
+ }
+ }
+
+ public function connect()
+ {
+ $aMsg['channel'] = '/meta/connect';
+ $aMsg['id'] = $this->nNextId++;
+ $aMsg['clientId'] = $this->clientId;
+ $aMsg['connectionType'] = 'long-polling';
+
+ curl_setopt($this->oCurl, CURLOPT_POSTFIELDS, "message=".urlencode(str_replace('\\', '', json_encode(array($aMsg)))));
+
+ $data = curl_exec($this->oCurl);
+ }
+
+ function disconnect()
+ {
+ $msgHandshake = array();
+ $msgHandshake['channel'] = '/meta/disconnect';
+ $msgHandshake['id'] = $this->nNextId++;
+ $msgHandshake['clientId'] = $this->clientId;
+
+ curl_setopt($this->oCurl, CURLOPT_POSTFIELDS, "message=".urlencode(str_replace('\\', '', json_encode(array($msgHandshake)))));
+
+ curl_exec($this->oCurl);
+ }
+
+ public function publish($sChannel, $oData)
+ {
+ if(!$sChannel || !$oData)
+ return;
+
+ $aMsg = array();
+
+ $aMsg['channel'] = $sChannel;
+ $aMsg['id'] = $this->nNextId++;
+ $aMsg['data'] = $oData;
+ $aMsg['clientId'] = $this->clientId;
+
+ curl_setopt($this->oCurl, CURLOPT_POSTFIELDS, "message=".urlencode(str_replace('\\', '', json_encode(array($aMsg)))));
+
+ $data = curl_exec($this->oCurl);
+// var_dump($data);
+ }
+}
--- /dev/null
+<?php
+/*
+ *
+ * Phomet: a php comet client
+ *
+ * Copyright (C) 2008 Morgan 'ARR!' Allen <morganrallen@gmail.com> http://morglog.alleycatracing.com
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+class Bayeux
+ {
+ private $oCurl = '';
+ private $nNextId = 0;
+
+ public $sUrl = '';
+
+ function __construct($sUrl)
+ {
+ $this->sUrl = $sUrl;
+
+ $this->oCurl = curl_init();
+
+ $aHeaders = array();
+ $aHeaders[] = 'Connection: Keep-Alive';
+
+ curl_setopt($this->oCurl, CURLOPT_URL, $sUrl);
+ curl_setopt($this->oCurl, CURLOPT_HTTPHEADER, $aHeaders);
+ curl_setopt($this->oCurl, CURLOPT_HEADER, 0);
+ curl_setopt($this->oCurl, CURLOPT_POST, 1);
+ curl_setopt($this->oCurl, CURLOPT_RETURNTRANSFER,1);
+
+ $this->handShake();
+ }
+
+ function __destruct()
+ {
+ $this->disconnect();
+ }
+
+ function handShake()
+ {
+ $msgHandshake = array();
+ $msgHandshake['channel'] = '/meta/handshake';
+ $msgHandshake['version'] = "1.0";
+ $msgHandshake['minimumVersion'] = "0.9";
+ $msgHandshake['id'] = $this->nNextId++;
+
+ curl_setopt($this->oCurl, CURLOPT_POSTFIELDS, "message=".urlencode(str_replace('\\', '', json_encode(array($msgHandshake)))));
+
+ $data = curl_exec($this->oCurl);
+
+ if(curl_errno($this->oCurl))
+ die("Error: " . curl_error($this->oCurl));
+
+ $oReturn = json_decode($data);
+ $oReturn = $oReturn[0];
+
+ $bSuccessful = ($oReturn->successful) ? true : false;
+
+ if($bSuccessful)
+ {
+ $this->clientId = $oReturn->clientId;
+
+ $this->connect();
+ }
+ }
+
+ public function connect()
+ {
+ $aMsg['channel'] = '/meta/connect';
+ $aMsg['id'] = $this->nNextId++;
+ $aMsg['clientId'] = $this->clientId;
+ $aMsg['connectionType'] = 'long-polling';
+
+ curl_setopt($this->oCurl, CURLOPT_POSTFIELDS, "message=".urlencode(str_replace('\\', '', json_encode(array($aMsg)))));
+
+ $data = curl_exec($this->oCurl);
+ }
+
+ function disconnect()
+ {
+ $msgHandshake = array();
+ $msgHandshake['channel'] = '/meta/disconnect';
+ $msgHandshake['id'] = $this->nNextId++;
+ $msgHandshake['clientId'] = $this->clientId;
+
+ curl_setopt($this->oCurl, CURLOPT_POSTFIELDS, "message=".urlencode(str_replace('\\', '', json_encode(array($msgHandshake)))));
+
+ curl_exec($this->oCurl);
+ }
+
+ public function publish($sChannel, $oData)
+ {
+ if(!$sChannel || !$oData)
+ return;
+
+ $aMsg = array();
+
+ $aMsg['channel'] = $sChannel;
+ $aMsg['id'] = $this->nNextId++;
+ $aMsg['data'] = $oData;
+ $aMsg['clientId'] = $this->clientId;
+
+ curl_setopt($this->oCurl, CURLOPT_POSTFIELDS, "message=".urlencode(str_replace('\\', '', json_encode(array($aMsg)))));
+
+ $data = curl_exec($this->oCurl);
+// var_dump($data);
+ }
+ }
--- /dev/null
+(function($)\r
+{\r
+ var msgHandshake =\r
+ {\r
+ version: '1.0',\r
+ minimumVersion: '0.9',\r
+ channel: '/meta/handshake'\r
+ };\r
+\r
+ var oTransport = function()\r
+ {\r
+ this._bXD = \r
+ (($.comet._sUrl.substring(0,4) == 'http') && ($.comet._sUrl.substr(7,location.href.length).replace(/\/.*/, '') != location.host))\r
+ ?\r
+ true\r
+ :false;\r
+\r
+ this.connectionType = (this._bXD) ? 'callback-polling' : 'long-polling';\r
+\r
+ this.startup = function(oReturn)\r
+ {\r
+ if(this._comet._bConnected) return;\r
+ this.tunnelInit();\r
+ };\r
+\r
+ this.tunnelInit = function()\r
+ {\r
+ var msgConnect = \r
+ {\r
+ channel: '/meta/connect',\r
+ clientId: $.comet.clientId, \r
+ id: String($.comet._nNextId++),\r
+ connectionType: $.comet._oTransport.connectionType\r
+ };\r
+\r
+ this.openTunnel(msgConnect);\r
+ };\r
+\r
+ this.openTunnel = function(oMsg)\r
+ {\r
+ $.comet._bPolling = true;\r
+\r
+ this._send($.comet._sUrl, oMsg, function(sReturn)\r
+ {\r
+ var oReturn = (typeof sReturn != "object") ? (eval('(' + sReturn + ')')) : sReturn;\r
+ $.comet._bPolling = false;\r
+ $.comet.deliver(oReturn);\r
+ $.comet._oTransport.closeTunnel();\r
+ });\r
+ };\r
+\r
+ this.closeTunnel = function()\r
+ {\r
+ if(!$.comet._bInitialized) return;\r
+\r
+ if($.comet._advice)\r
+ {\r
+ if($.comet._advice.reconnect == 'none') return;\r
+\r
+ if($.comet._advice.interval > 0)\r
+ {\r
+ setTimeout($.comet._oTransport._connect, $.comet._advice.interval);\r
+ }\r
+ else\r
+ {\r
+ $.comet._oTransport._connect();\r
+ }\r
+ }\r
+ else\r
+ {\r
+ $.comet._oTransport._connect();\r
+ }\r
+ };\r
+\r
+ this._connect = function()\r
+ {\r
+ if(!$.comet._bInitialized) return;\r
+\r
+ if($.comet._bPolling) return;\r
+\r
+ if($.comet._advice && $.comet._advice.reconnect == 'handshake')\r
+ {\r
+ $.comet._bConnected = false;\r
+ $.comet.init($.comet._sUrl);\r
+ }\r
+ else if($.comet._bConnected)\r
+ {\r
+ var msgConnect = \r
+ {\r
+ //jsonp: 'test',\r
+ clientId: $.comet.clientId,\r
+ id: String($.comet._nNextId++),\r
+ channel: '/meta/connect',\r
+ connectionType: $.comet._oTransport.connectionType\r
+ };\r
+ $.comet._oTransport.openTunnel(msgConnect);\r
+ }\r
+ };\r
+\r
+ this._send = function(sUrl, oMsg, fCallback) {\r
+ //default callback will check advice, deliver messages, and reconnect\r
+ var fCallback = (fCallback) ? fCallback : function(sReturn)\r
+ {\r
+ var oReturn = (typeof sReturn != "object") ? (eval('(' + sReturn + ')')) : sReturn;\r
+\r
+ $.comet.deliver(oReturn);\r
+\r
+ if($.comet._advice)\r
+ {\r
+ if($.comet._advice.reconnect == 'none')\r
+ return;\r
+\r
+ if($.comet._advice.interval > 0)\r
+ {\r
+ setTimeout($.comet._oTransport._connect, $.comet._advice.interval);\r
+ }\r
+ else\r
+ {\r
+ $.comet._oTransport._connect();\r
+ }\r
+ }\r
+ else\r
+ {\r
+ $.comet._oTransport._connect();\r
+ }\r
+ };\r
+\r
+ //regular AJAX for same domain calls\r
+ if((!this._bXD) && (this.connectionType == 'long-polling'))\r
+ {\r
+ this._pollRequest = $.ajax({\r
+ url: sUrl,\r
+ type: 'post',\r
+ beforeSend: function(oXhr) { oXhr.setRequestHeader('Connection', 'Keep-Alive'); },\r
+ data: { message: JSON.stringify(oMsg) },\r
+ success: fCallback\r
+ });\r
+ }\r
+ else // JSONP callback for cross domain\r
+ {\r
+ this._pollRequest = $.ajax({\r
+ url: sUrl,\r
+ dataType: 'jsonp',\r
+ jsonp: 'jsonp',\r
+ beforeSend: function(oXhr) { oXhr.setRequestHeader('Connection', 'Keep-Alive'); },\r
+ data: \r
+ { \r
+ message: JSON.stringify($.extend(oMsg,{connectionType: 'callback-polling' })) \r
+ },\r
+ success: fCallback\r
+ });\r
+ }\r
+ }\r
+ };\r
+\r
+ $.comet = new function()\r
+ {\r
+ this.CONNECTED = 'CONNECTED';\r
+ this.CONNECTING = 'CONNECTING';\r
+ this.DISCONNECTED = 'DISCONNECTED';\r
+ this.DISCONNECTING = 'DISCONNECTING';\r
+\r
+ this._aMessageQueue = [];\r
+ this._aSubscriptions = [];\r
+ this._aSubscriptionCallbacks = [];\r
+ this._bInitialized = false;\r
+ this._bConnected = false;\r
+ this._nBatch = 0;\r
+ this._nNextId = 0;\r
+ // just define the transport, do not assign it yet.\r
+ this._oTransport = ''; //oTransport;\r
+ this._sUrl = '';\r
+\r
+ this.supportedConectionTypes = [ 'long-polling', 'callback-polling' ];\r
+\r
+ this.clientId = '';\r
+\r
+ this._bTrigger = true; // this sends $.event.trigger(channel, data)\r
+\r
+ this.init = function(sUrl)\r
+ {\r
+ this._sUrl = (sUrl) ? sUrl : '/cometd';\r
+\r
+ this._oTransport = new oTransport();\r
+\r
+ this._aMessageQueue = [];\r
+ this._aSubscriptions = [];\r
+ this._bInitialized = true;\r
+ this.startBatch();\r
+\r
+ var oMsg = $.extend(msgHandshake, {id: String(this._nNextId++)});\r
+\r
+ this._oTransport._send(this._sUrl, oMsg, $.comet._finishInit);\r
+ };\r
+\r
+ this._finishInit = function(sReturn)\r
+ {\r
+ var oReturn = (typeof sReturn != "object") ? (eval('(' + sReturn + ')')[0]) : sReturn[0];\r
+\r
+ if(oReturn.advice)\r
+ $.comet._advice = oReturn.advice;\r
+\r
+ var bSuccess = (oReturn.successful) ? oReturn.successful : false;\r
+ // do version check\r
+\r
+ if(bSuccess)\r
+ {\r
+ // pick transport ?\r
+ // ......\r
+\r
+ $.comet._oTransport._comet = $.comet;\r
+ $.comet._oTransport.version = $.comet.version;\r
+\r
+ $.comet.clientId = oReturn.clientId;\r
+ $.comet._oTransport.startup(oReturn);\r
+ $.comet.endBatch();\r
+ }\r
+ };\r
+\r
+ this._sendMessage = function(oMsg)\r
+ {\r
+ if($.comet._nBatch <= 0)\r
+ {\r
+ if(oMsg.length > 0)\r
+ for(var i in oMsg)\r
+ {\r
+ oMsg[i].clientId = String($.comet.clientId);\r
+ oMsg[i].id = String($.comet._nNextId++);\r
+ }\r
+ else\r
+ {\r
+ oMsg.clientId = String($.comet.clientId);\r
+ oMsg.id = String($.comet._nNextId++);\r
+ }\r
+\r
+ $.comet._oTransport._send($.comet._sUrl, oMsg);\r
+ }\r
+ else\r
+ {\r
+ $.comet._aMessageQueue.push(oMsg);\r
+ }\r
+ };\r
+\r
+\r
+ this.startBatch = function() { this._nBatch++ };\r
+ this.endBatch = function() {\r
+ if(--this._nBatch <= 0)\r
+ {\r
+ this._nBatch = 0;\r
+ if(this._aMessageQueue.length > 0)\r
+ {\r
+ this._sendMessage(this._aMessageQueue);\r
+ this._aMessageQueue = [];\r
+ }\r
+ }\r
+ };\r
+\r
+ this.subscribe = function(sSubscription, fCallback)\r
+ {\r
+ // if this topic has not been subscribed to yet, send the message now\r
+ if(!this._aSubscriptions[sSubscription])\r
+ {\r
+ this._aSubscriptions.push(sSubscription)\r
+\r
+ if (fCallback) {\r
+ this._aSubscriptionCallbacks[sSubscription] = fCallback;\r
+ }\r
+\r
+ this._sendMessage({ channel: '/meta/subscribe', subscription: sSubscription });\r
+ }\r
+\r
+ //$.event.add(window, sSubscription, fCallback);\r
+ };\r
+\r
+ this.unsubscribe = function(sSubscription) {\r
+ $.comet._sendMessage({ channel: '/meta/unsubscribe', subscription: sSubscription });\r
+ };\r
+\r
+ this.publish = function(sChannel, oData)\r
+ {\r
+ $.comet._sendMessage({channel: sChannel, data: oData});\r
+ };\r
+\r
+ this.deliver = function(sReturn)\r
+ {\r
+ var oReturn = sReturn;//eval(sReturn);\r
+\r
+ $(oReturn).each(function()\r
+ {\r
+ $.comet._deliver(this);\r
+ });\r
+ };\r
+\r
+ this.disconnect = function()\r
+ {\r
+ $($.comet._aSubscriptions).each(function(i)\r
+ {\r
+ $.comet.unsubscribe($.comet._aSubscriptions[i]);\r
+ });\r
+\r
+ $.comet._sendMessage({channel:'/meta/disconnect'});\r
+\r
+ $.comet._bInitialized = false;\r
+ }\r
+\r
+ this._deliver = function(oMsg,oData)\r
+ {\r
+ if(oMsg.advice)\r
+ {\r
+ $.comet._advice = oMsg.advice;\r
+ }\r
+\r
+ switch(oMsg.channel)\r
+ {\r
+ case '/meta/connect':\r
+ if(oMsg.successful && !$.comet._bConnected)\r
+ {\r
+ $.comet._bConnected = $.comet._bInitialized;\r
+ $.comet.endBatch();\r
+ /*\r
+ $.comet._sendMessage(msgConnect);\r
+ */\r
+ }\r
+ else\r
+ {}\r
+ //$.comet._bConnected = false;\r
+ break;\r
+\r
+ // add in subscription handling stuff\r
+ case '/meta/subscribe':\r
+ if(!oMsg.successful)\r
+ {\r
+ $.comet._oTransport._cancelConnect();\r
+ return;\r
+ }\r
+ break;\r
+\r
+ case '/meta/unsubscribe':\r
+ if(!oMsg.successful)\r
+ {\r
+ $.comet._oTransport._cancelConnect();\r
+ return;\r
+ }\r
+ break;\r
+\r
+ }\r
+\r
+ if(oMsg.data)\r
+ {\r
+ if($.comet._bTrigger)\r
+ {\r
+ $.event.trigger(oMsg.channel, [oMsg]);\r
+ }\r
+\r
+ var cb = $.comet._aSubscriptionCallbacks[oMsg.channel];\r
+ if (cb) {\r
+ cb(oMsg);\r
+ }\r
+ }\r
+ };\r
+};\r
+\r
+})(jQuery);\r
--- /dev/null
+// update the local timeline from a Comet server
+//
+