PHP code example of jasonrgd / zf2-websocket-server-factory
1. Go to this page and download the library: Download jasonrgd/zf2-websocket-server-factory 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/ */
jasonrgd / zf2-websocket-server-factory example snippets
php composer.phar install -o
// for example
echo $this->socket()->config('host'); // print 127.0.0.1
$result .= isset($row[0]) ? $row[0] . "\n" : '';
src\WebSockets\Aware\ApplicationInterface.php
src\WebSockets\Application\Chat.php
// get factory container
$factory = new ApplicationFactory($this->getServiceLocator());
// applications from response <app>
// get it @see /src/WebSockets/Application/Chat.php etc..
$client = $request->getParam('app');
$app = $factory->dispatch(ucfirst($client));
// bind events from application
// ! must be implements of your every new Application
$app->bind('open', 'onOpen');
$app->bind('message', 'onMessage');
$app->bind('close', 'onClose');
// running server
$app->run();
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.