Code Monkey home page Code Monkey logo

kohana-realplexor's Introduction

What is it?

The Kohana 3.2 api library for Dklab Realplexor: Comet server by Dmitry Koterov, dkLab (C) which handles 1000000+ parallel browser connections.

Configuration

  1. Install Dklab Realplexor
  2. Plug-in kohana-realplexor module in bootstrap.php
  3. Tune config/realplexor.php default connection profile for your needs
  4. 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);
}

kohana-realplexor's People

Contributors

vinks avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.