Join 4,000+ others and never miss out on new tips, tutorials, and more.
Latest version:
pecl install openswoole-25.2.0 | composer require openswoole/core:22.1.5
<?php OpenSwoole\Server->on('PipeMessage', Callable $callback)
The event callback name.
Callable event function.
If success, it returns true, otherwise it returns false.
Execute the callback function when the Server is receiving the message sent by sendMessage.
The callback function registered on the event PipeMessage is executed in the Worker Process which is receiving data when using $server->sendMessage(). Both worker and task worker processes are able to trigger this PipeMessage event.
<?php
$server->on('PipeMessage', function(OpenSwoole\Server $server, int $fromWorkerId, mixed $message)
{
// ...
});
$fromWorkerId The ID number of worker where the message is from$message the message that has been received