PHP code example of adt / ratchet
1. Go to this page and download the library: Download adt/ratchet 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/ */
adt / ratchet example snippets
$container = getByType('ADT\Ratchet\Server')->run();
php web/server.php
namespace App\RatchetModule\Controllers;
use \Ratchet\ConnectionInterface;
use \Guzzle\Http\Message\RequestInterface;
class InstantionResolver implements \ADT\Ratchet\Controllers\IInstantionResolver {
public function getInstantionIdentifier(RequestInterface $request, ConnectionInterface $conn) {
$origin = new \Nette\Http\Url($request->getHeader('origin')->toArray()[0]);
return $origin->host;
}
}