You read my mind. Although I could muscle my way into the "Channel
API" beta, I'd prefer to wait until it is publicly launched and stable
before overhauling MobWrite to take advantage of this mechanism.
Otherwise comet would work on the mobwrite3.appspot.com instance but
fail for everyone else.
In terms of adapting the algorithm, the most straight forward approach
would be to modify the client to sync once a second and modify the
server to hold onto the connection for up to 30 seconds if there is no
server-to-client message to be sent. The client would also be
modified to timeout after two seconds if there is another local
change, and 45 seconds if there isn't. This would result in one
connection per message (as currently implemented), but the latency for
server-to-client messages would drop to under a second since there
would always be a stalled connection waiting to take it. The existing
packet-loss mechanisms would handle all the timed out connections.
Not only would this reduce latency, but it would also reduce the
workload on the server. Once the Channel API is released, this will
become the top priority for MobWrite.
--
Neil Fraser, Programmer & Wizard
http://neil.fraser.name