PHP code example of valeriitropin / socketio-emitter
1. Go to this page and download the library: Download valeriitropin/socketio-emitter library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
valeriitropin / socketio-emitter example snippets
use React\EventLoop\Factory as ReactFactory;
use ValeriiTropin\Socketio\Emitter;
$loop = ReactFactory::create();
$emitter = new Emitter($loop);
$promise = $emitter->to($room)->emit($event, $data)
->then(function () {})
->otherwise(function ($error) {});
$emitter->to($room);
$emitter->of($namespace);
$emitter->emit($event, $data)
->then(function () {})
->otherwise(function ($error) {});