Skip to content

Instantly share code, notes, and snippets.

@harveyslash
Created August 18, 2016 11:19
Show Gist options
  • Save harveyslash/428fafef7679ecf0522b2748cbb0f7ea to your computer and use it in GitHub Desktop.
Save harveyslash/428fafef7679ecf0522b2748cbb0f7ea to your computer and use it in GitHub Desktop.
private function startWampServer()
{
$loop = \React\EventLoop\Factory::create();
// $class = $this->option('class');
// $ratchetServer = new $class($this);
// $this->info(sprintf('Starting ZMQ server on: %s:%s', config('ratchet.zmq.host'), config('ratchet.zmq.port')));
// $context = new \React\ZMQ\Context($loop);
// $pull = $context->getSocket(\ZMQ::SOCKET_PULL);
// $pull->bind(sprintf('tcp://%s:%d', config('ratchet.zmq.host'), config('ratchet.zmq.port')));
//
// $pull->on('message', function($message) use ($ratchetServer) {
// $ratchetServer->onEntry($message);
// });
$webSock = new \React\Socket\Server($loop);
$webSock->listen($this->port, $this->host);
$webServer = new \Ratchet\Server\IoServer(
new \Ratchet\Http\HttpServer(
new \Ratchet\WebSocket\WsServer(
new PusherServer()
)
),
$webSock
);
return $loop;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment