I would like to use both chat and push notifications applications on the same server, starting with the ratchet tutorial ( http://socketo.me ) - Hello World ( http://socketo.me/docs/hello-world ) - "push integration" with ZMQ.
each application works well, I run chat-server.php (for chat) and push-server.php (for integration with push). But when I open two cmd windows and run them, it does not work. This may be a stupid question, but I'm new to this area.
find the code as executable
chat-server.php:
use Ratchet \ Server \ IoServer; use MyApp \ Chat;
require dirname(__DIR__) . '/vendor/autoload.php';
$server = IoServer::factory(
new Chat(),
8080
);
$server->run();
push-server.php:
require dirname(__DIR__) . '/vendor/autoload.php';
$loop = React\EventLoop\Factory::create();
$pusher = new MyApp\Pusher;
$context = new React\ZMQ\Context($loop);
$pull = $context->getSocket(ZMQ::SOCKET_PULL);
$pull->bind('tcp://127.0.0.1:5555');
$pull->on('message', array($pusher, 'onBlogEntry'));
$webSock = new React\Socket\Server($loop);
$webSock->listen(8080, '0.0.0.0');
$webServer = new Ratchet\Server\IoServer(
new Ratchet\Http\HttpServer(
new Ratchet\WebSocket\WsServer(
new Ratchet\Wamp\WampServer(
$pusher
)
)
),
$webSock
);
$loop->run();
.