基本上没有React \ ZMQ \ Context事件触发,我也不知道为什么会发生这种情况,我想知道是否有人可以帮助我解决我的问题。
我尝试更改tcp连接的端口,但所有端口均不起作用。
// ajax file
add_post.php
$context = new ZMQContext();
$socket = $context->getSocket(ZMQ::SOCKET_PUSH, 'my pusher');
$socket->connect('tcp://127.0.0.1:5555');
$socket->send(json_encode($data));
// push_server.php
$loop = \React\EventLoop\Factory::create();
$pusher = new \App\Pusher();
$context = new \React\ZMQ\Context($loop);
$pull = $context->getSocket(ZMQ::SOCKET_PULL);
$pull->bind('tcp://127.0.0.1:5555');
$pull->on( 'open', function( $msg ){ echo "open"; } );
$pull->on( 'close', function( $msg ){ echo "close"; } );
$pull->on( 'message', function( $msg ){ echo "message"; } );
$pull->on( 'error', function( $msg ){ echo "error"; } );
$webSock = new \React\Socket\Server('127.0.0.1:8000', $loop);
$webServer = new \Ratchet\Server\IoServer(
new \Ratchet\Http\HttpServer(
new \Ratchet\WebSocket\WsServer(
new \Ratchet\Wamp\WampServer(
$pusher
)
)
),
$webSock
);
$loop->run();
// client.html
let conn = new ab.Session('ws://127.0.0.1:8000', function () {
conn.subscribe('onData', function (topic, data) {
console.log({topic, data})
})
});
我想知道为什么事件永远不会触发