i have committed a new delivery protocol for chat, which is much faster and less resource demanding.
The current xowiki chat and the chat package in the ajax variant are based on a polling interface. This means that the browser asks every n seconds (per default all 5 seconds) whether there are updates available and displays it accordingly.
The new streaming ajax based variant behaves like downloading a large file when subscribing to a channel. The client opens a connection to the server and reads piecewise the information back. Therefore there is no 5 second gap and no polling necessary. In the plain aolserver, this approach would not be reasonable, since a connection thread would be blocked for every user participating in a chat. aolserver would soon run out of connection threads. I have solved this problem via background delivery thread described already in
http://www.openacs.org/forums/message-view?message_id=342566.
With the streaming interface, a client can subscribe to a channel identified by a name, and some other client can broadcast to all users subscribed by the channel. in case of the chat, the channel identifier is simply chat+$chat_id. The streaming chat interface requires libthread and a small patch for the aolserver (see link above). It does currently not work for safari, since - as it looks to me - safari allows only one xmlhttp object concurrently active (strange enough, i did not find complaints about this on the web).
While the polling ajax chat uses xml for coding the messages, the streaming variant uses JSON enoding.
With the current implementation the same chat can be used simultanously with the polling and streaming interface from different clients. The login proc tries to make a clever guess and uses the streaming interface only, when the browser is capable for multiple xmlhttp connections and when the backend has libthread.
In order to try the streaming interface, use firefox and insert into an xowiki object the content:
proc content {} {
::xowiki::Chat login -chat_id 22
}
In order to force the polling interface, use e.g.
::xowiki::Chat login -chat_id 22 -mode polling
The chat package is still using the polling interface only.
If you want to use thre streaming interface please update xotcl-core, xowiki and xotcl-request-monitor (if you have it installed).