Worker发送信息到客户端后连接会断开

linjiuqian20
use Workerman\Worker;
use Workerman\Autoloader;

// autoload
require_once __DIR__ . '/../../Workerman/Autoloader.php';

$worker = new Worker("tcp://0.0.0.0:3737");
$worker->name = 'gbapp';
$worker->onMessage = function($connection, $data)
{
    foreach($connection->worker->connections as $con)
    {
        $con->send($data);
    }
};
Worker::runAll();
3911 1 0
1个回答

walkor 打赏

代码本地测试没有问题。

telnet 127.0.0.1 3737
Trying 127.0.0.1...
Connected to 127.0.0.1.
Escape character is '^]'.
hello
hello
hi
hi

请说明使用的客户端,如何操作出现的问题,问题现象?

  • 暂无评论
年代过于久远,无法发表回答
×
🔝