ext-swooleis supported until v4.7.1, use
ext-openswoole>= v4.7.1. Latest version:
pecl install openswoole-4.9.1
<?php Swoole\Server->on('Packet', Callable $callback)
The event callback name.
Callable event function.
If success, it returns
true, otherwise it returns
Execute the callback function when the Server is receiving UDP data packets.
The callback function registered on the event
packet is executed in the
Worker Process which is receiving data.
$datathe UDP data packet received, may be a string or binary data
$clientInfo, this data is an array, information about the connected client
Array example of
[ server_socket => 4, server_port => 9501, address => 127.0.0.1, port => 47306, ]
If the Server is listening on both TCP and UDP ports, the
Receive callback function is executed when TCP data is received and the
Packet callback function is executed when UDP data is received.