Swoole\Server->on('pipemessage', fn)

Declaration

<?php
Swoole\Server->on('pipemessage', callback $callback)

Parameters

event

The event name

callback

callback function

Return

success

if success, it returns TRUE, otherwise it returns FALSE.

Description

Executue 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.

Callback function

<?php
function (Swoole\Server $server, int $from_worker_id, mixed $message) {

}
  • $from_worker_id the id number of worker when the message from
  • $message the message

Example