https://github.com/vinks/kohana-realplexor
Kohana API for DmitryKoterov [Dklab Realplexor]: Comet server which handles 1000000+ parallel browser connections.
https://github.com/vinks/kohana-realplexor
Last synced: 4 months ago
JSON representation
Kohana API for DmitryKoterov [Dklab Realplexor]: Comet server which handles 1000000+ parallel browser connections.
- Host: GitHub
- URL: https://github.com/vinks/kohana-realplexor
- Owner: vinks
- Created: 2011-09-08T11:33:32.000Z (almost 15 years ago)
- Default Branch: master
- Last Pushed: 2011-09-08T12:05:46.000Z (almost 15 years ago)
- Last Synced: 2025-02-28T11:51:51.255Z (over 1 year ago)
- Homepage:
- Size: 92.8 KB
- Stars: 2
- Watchers: 4
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## What is it?
The Kohana 3.2 api library for [Dklab Realplexor](https://github.com/DmitryKoterov/dklab_realplexor): Comet server by Dmitry Koterov, dkLab (C) which handles 1000000+ parallel browser connections.
## Configuration
1. Install [Dklab Realplexor](https://github.com/DmitryKoterov/dklab_realplexor)
1. Plug-in kohana-realplexor module in bootstrap.php
2. Tune *config/realplexor.php* default connection profile for your needs
3. *Realplexor::instance()* returns realplexor api object with default profile. Certainly you can use an arbitrary profile name 'some-profile-name', that case use *Realplexor::instance('some-profile-name')*
## Usage
$rpl = Realplexor::instance();
// Send data to one channel.
$rpl->send("Alpha", array("here" => "is", "any" => array("structured", "data")));
// Send data to multiple channels at once.
$rpl->send(array("Alpha", "Beta"), "any data");
// Send data limiting receivers.
$rpl->send("Alpha", "any data", array($id1, $id2, ...));
// Send data with manual cursor specification (10 and 20).
$rpl->send(array("Alpha" => 10, "Beta" => 20), "any data");
// Get the list of all listened channels.
$list = $rpl->online();
// Get the list of online channels which names are started with "id_" only.
$list = $rpl->online(array("id_"));
// Watching status changes for channels 'id_***' from $pos"
$pos = 0;
while (1) {
foreach ($rpl->watch($pos, "id_") as $event) {
echo "Received: {$event['event']} - {$event['id']}\n";
$pos = $event['pos'];
}
usleep(300000);
}