Example
The goal is to make the usage as transparent as possible. Send an event from the backend (e.g. php) and react on the event in your browser.
Backend
<?php //PROTOTYPE CODE TO EXPLAIN THE IDEA $turt=new TURTED(); //notify only one user $turt->notifyUser($username,$eventname,$payloadAsArray); //notify all users on a channel $turt->notifyChannel($channelname,$eventname,$payloadAsArray);
Javascript Client
//PROTOTYPE CODE TO EXPLAIN THE IDEA var username="Sunny"; //instanciate event handler var turt=new TURTEH(username); //listen/wait for an event turt.listen('eventName',function(payload){ //do something showNotification(payload.my_text); });
Since there are many ways to achieve this and different backend technologies can be involved, the goal is to provide a collection of modules that are as interoperable as possible and still transparent to the user.
This also means, that there should be a unique client side Event Handler that does not care about the backend or the Comet server, but provide a defined interface.