walkor / workerman

An asynchronous event driven PHP socket framework. Supports HTTP, Websocket, SSL and other custom protocols.
http://www.workerman.net
MIT License
11.03k stars 2.25k forks source link

Update worker #967

Closed twomiao closed 9 months ago

twomiao commented 9 months ago

简化代码编写。

twomiao commented 9 months ago

`<?php require DIR . "/vendor/autoload.php";

use Workerman\Events\Swoole; use Workerman\Worker;

Worker::$globalEvent = new Swoole(); $worker = new Worker("http://0.0.0.0:8888"); $worker->name = "http-worker"; $worker->count = 4; $worker->reusePort = false;

$worker->onMessage = fn($connection) => $connection->send("hello world!!"); Worker::runAll(); ` 问题复现代码。