You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a list of 500 results that I want to send from my zmq worker class to my server class. Now I am trying to send the first 50 results and then do some processing for the next 450 results and then send them on the same zmq socket. But what i see is on the server side I am getting both the response together. I was expecting that the first 50 results will reach server and the server can send it to client and when it gets the other 450 results it can then send it back to client. Below is the code that I use
Server Code File
$loop = \React\EventLoop\Factory::create();
$context = new React\ZMQ\Context($loop);
$pusher = $context->getSocket(ZMQ::SOCKET_PUSH);
$pusher->bind("tcp://127.0.0.1:8889");
$applicationObj = new ServerApplication($pusher);
$sink = $context->getSocket(ZMQ::SOCKET_PULL);
$sink->bind("tcp://127.0.0.1:8888");
$sink->on("message", function ($message) use ($applicationObj) {
TODO: SEND MESSAGE TO CLIENT
});
$webSock = new React\Socket\Server($loop);
$webSock->listen($options["serverport"], "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($applicationObj)
),
$webSock
);
$loop->run();
Worker Code File
$loop = \React\EventLoop\Factory::create();
$context = new React\ZMQ\Context($loop);
$pull = $context->getSocket(ZMQ::SOCKET_PULL);
$pull->connect('tcp://127.0.0.1:8889');
$push = $context->getSocket(ZMQ::SOCKET_PUSH);
$push->connect('tcp://127.0.0.1:8888');
$pull->on('message', function($message) use ($loop, $push) {
$response = []; (this is an array of initial 50 results)
$push->send($response);
$next_res = get_next_450_results();
$new_resp = []; (this is array of next 450 results)
$push->send($new_resp)
});
$loop->run();
Can someone please help me with the issue here, basically I am not able to send the response from worker to server in paginated way.
I am using php ratchet and zmq.
The text was updated successfully, but these errors were encountered:
aks2193
changed the title
Trying to execute multiple zmq send in same event loop
Execute multiple zmq send in same event loop
Feb 15, 2024
aks2193
changed the title
Execute multiple zmq send in same event loop
Execute multiple zmq send in same event loop with php ratchet
Feb 15, 2024
Hey,
I have a list of 500 results that I want to send from my zmq worker class to my server class. Now I am trying to send the first 50 results and then do some processing for the next 450 results and then send them on the same zmq socket. But what i see is on the server side I am getting both the response together. I was expecting that the first 50 results will reach server and the server can send it to client and when it gets the other 450 results it can then send it back to client. Below is the code that I use
Server Code File
Worker Code File
Can someone please help me with the issue here, basically I am not able to send the response from worker to server in paginated way.
I am using php ratchet and zmq.
The text was updated successfully, but these errors were encountered: