$udp_worker = new Worker('udp://0.0.0.0:1112');
$udp_worker->count = 1;
$udp_worker->name = 'MyWebsocketWorker';
$udp_worker2 = new Worker('udp://0.0.0.0:1113');
$udp_worker2->count = 1;
$udp_worker2->name = 'MyWebsocketWorker2';
如何共用onWorkerStart和onMessage,感谢!
$udp_worker = new Worker('udp://0.0.0.0:1112');
$udp_worker->count = 1;
$udp_worker->name = 'MyWebsocketWorker';
$udp_worker->onMessage = 'on_message';
$udp_worker2 = new Worker('udp://0.0.0.0:1113');
$udp_worker2->count = 1;
$udp_worker2->name = 'MyWebsocketWorker2';
$udp_worker2->onMessage = 'on_message';
function on_message($con, $data) {
echo $data;
}
谢谢!