A PHP implementation of node.js socket.io-emitter.
composer require Furality/socket.io-php-emitter
use Predis\Client;
use Furality\SocketIO\Emitter;
...
$client = new Client();
(new Emitter($client))
->of('namespace')->emit('event', 'payload message');
Possible flags
- json
- volatile
- broadcast
use Predis\Client;
use Furality\SocketIO\Emitter;
...
$client = new Client();
(new Emitter($client))
->broadcast->emit('broadcast-event', 'payload message');
(new Emitter($client))
->flag('broadcast')->emit('broadcast-event', 'payload message');
use Predis\Client;
use Furality\SocketIO\Emitter;
...
$client = new Client();
(new Emitter($client))
->emit('broadcast-event', ['param1' => 'value1', 'param2' => 'value2', ]);
use Predis\Client;
use Furality\SocketIO\Emitter;
...
$client = new Client();
(new Emitter($client))
->in(['room1', 'room2'])
->emit('broadcast-event', ['param1' => 'value1', 'param2' => 'value2', ]);
This library is forked from shakahl/socket.io-emitter created by Soma Szélpál.
The shakahl/socket.io-emitter is forked from exls/socket.io-emitter created by Anton Pavlov.