Class 'Ratchet\Http\HttpServer' not found in /var/www/html/sittest/php_chat/bin/pusher.php on line 5

33 views
Skip to first unread message

sunnyk...@gmail.com

unread,
Apr 16, 2016, 11:58:53 AM4/16/16
to Ratchet
require dirname(__DIR__) . '/vendor/autoload.php';
use React\ZMQ\Context;
use React\ZMQ\ZMQ;
use React\ZMQ\ZMQContext;
use App\Chat;


$loop   = React\EventLoop\Factory::create();
$context = new Context($loop,new ZMQContext());
$pusher = new Chat;

// Listen for the web server to make a ZeroMQ push after an ajax request
         
$pull = $context->getSocket(ZMQ::SOCKET_PULL);
//$pull->bind('tcp://192.168.0.100:5555'); // Binding to 127.0.0.1 means the only client that can connect is itself
//$pull->on('message', array($pusher, 'onBlogEntry'));

// Set up our WebSocket server for clients wanting real-time updates
$webSock = new React\Socket\Server($loop);
$webSock->listen(3000, '0.0.0.0'); // Binding to 0.0.0.0 means remotes can connect
$webServer = new Ratchet\Server\IoServer(
    new Ratchet\Http\HttpServer(
        new Ratchet\WebSocket\WsServer(
            new Ratchet\Wamp\WampServer(
                $pusher
            )
        )
    ),
    $webSock
);

$loop->run();
Reply all
Reply to author
Forward
0 new messages