Pxxo_Widget_Comet

This widget can be used to establish a “server to client” persistent connection. It makes possible real time client updates using HTTP connections only. Server side a unique process is kept alive and is dedicated for sending fresh data to the client. However, this widget do not allows the client to send data to this persistent process. For a such feature, have a look to Pxxo_Widget_Socket. Internally this widget uses HTML iframe coupled with an PHP's “infinite loop” server side. This way the Comet stuff is multi browsers (IE, Firefox, Safari, Opera). CGI::IRC software uses equivalent technique for its persistent connection.

Client API

Pxxo_Widget_Comet decorator provides the javascript class you have to use to create the persistent connection between the server and the client. Its name is the value of the widget's $ClassID (most of the time: Pxxo_Widget_Comet)

So, to instantiate the comet class in your widget class, you have to do something like that :

var mycomet = new Pxxo_Widget_Comet();

Usable methods are :

  • void bindOnDataEvent(callback);
  • void bindOnConnectEvent(callback);
  • void bindOnDisconnectEvent(callback);
  • void connect();

When using this widget behind a reverse proxy, in order to enable the connexion to have to add these apache directives into your reverse proxy config:

  SetEnv force-proxy-request-1.0 1
  SetEnv proxy-nokeepalive       1

This widget can be used to establish a persistent connexion in javascript (read and write). It simply simulates a network socket, but in javascript, over HTTP. Internally this widget uses Pxxo_Widget_Comet coupled with classic AJAX calls to create a persistent and bidirectional tunnel between the server and the client. Server side, data are manipulated (send/receive) in a unique process.

i18n customization

Using the parameters array, it's possible to override the translations to match your needs. Here is a simple example:

$params['TranslateData']['YOUR_NICK_IS'] = 'My nick is %s';

If you think the official translation is wrong or bad, you are very welcomed to submit your proposition on the forum.

Fork me on GitHub