inpassor / realplexor
Realplexor PHP API
Requires
- php: >=5.4.0
This package is not auto-updated.
Last update: 2024-11-09 20:12:27 UTC
README
Author: Inpassor inpassor@yandex.com
GitHub repository: https://github.com/Inpassor/realplexor
This library implements Dklab_Realplexor PHP API.
Dklab_Realplexor is comet server which handles 1000000+ parallel browser connections.
Installation
composer require inpassor/realplexor
Usage
Create some class which uses the trait RealplexorAPI:
class Realplexor
{
use \inpassor\realplexor\RealplexorAPI;
...
}
Create the instance of this class (which uses the trait RealplexorAPI):
$realplexor = new Realplexor();
$realplexor->host = '127.0.0.1';
$realplexor->port = 10010;
$realplexor->namespace = 'rpl_';
Then use it:
$realplexor->send('Alpha',$someData);
Public Properties
Public methods
Protected methods
Method Details
public function send($idsAndCursors, $data, $showOnlyForIds = null)
Send data to Realplexor.
public function cmdOnlineWithCounters($idPrefixes = [])
Return list of online IDs (keys) and number of online browsers for each ID ("online" means "connected just now", it is very approximate).
public function cmdOnline($idPrefixes = [])
Return list of online IDs.
public function cmdWatch($fromPos, $idPrefixes = [])
Return all Realplexor events (e.g. ID offline/offline changes) happened after $fromPos cursor.
protected function _addNamespace($idPrefixes)
Add the namespace to ID prefixes.
protected function _cutNamespace($id)
Cut off the namespace from ID.
protected function _sendCmd($cmd)
Send IN command.
protected function _send($identifier, $body)
Send specified data to IN channel. Return response data.
Client-side
To implement Realplexor client-side feel free to use bower package inpassor-jquery-realplexor