From 7f57cffd81928115dd72cd0a5b64a1bc18884ab4 Mon Sep 17 00:00:00 2001 From: Chris Seufert Date: Fri, 8 Nov 2013 11:19:29 +1100 Subject: [PATCH] Proposed changes --- README.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/README.md b/README.md index 09f4a99..51824a4 100644 --- a/README.md +++ b/README.md @@ -9,8 +9,12 @@ daemon.php ```php on('connection', function($client) { $client->raise('ping'); + //Add example for sending data + $client->raise('updated',$data); $client->on('pong', function($data) { if($data['clientid'] == $client->id) { // Connection OK! @@ -26,6 +30,8 @@ $message = "You have mail"; $comet = new comet(); $client = $comet->getClient(123); // Client ID is 123 here $client->raise('message', ['message'=>$message]); +//Perhaps an alternative way could be +comentClient::client($clientid)::raise('message',$mydata); ``` comet.php @@ -33,6 +39,8 @@ comet.php process(); +//here also could be a static method +cometSession::listen(); ``` And an example of the JavaScript code: @@ -44,6 +52,7 @@ comet.on('ping', function(data) { comet.on('message', function(data) { console.log("Message received: " + data['message']); }); +//Should the client ID be able to be automatically assigned by the server? comet.start({'server': '/comet.php', 'clientid': 123}); ```