服务启动成功了,但是一直提示 package_length=1213486160

doujunyu

问题描述

启动之后一直提示Error package. package_length=1213486160,只要不ctrl+c 就一直提示

报错信息

Error package. package_length=1213486160Error package. package_length=1213486160Error package. package_length=1213486160Error package. package_length=1213486160Error package. package_length=1213486160Error package. package_length=1213486160Error package. package_length=1213486160Error package. package_length=1213486160Error package. package_length=1213486160Error package. package_length=1213486160Error package. package_length=1213486160Error package. package_length=1213486160Error package. package_length=1213486160Error package. package_length=1213486160Error package. package_length=1213486160Error package. package_length=1213486160^CWorkerman[think] stopping ...
448 1 0
1个回答

huazai

你的消息包太长了,可以看下TcpConnection.php
public $maxPackageSize = 1048576; 最大为10M。你的包超过了这个长度。

方案,自己设置下最大的size

use Workerman\Worker;
use Workerman\Connection\TcpConnection;
require_once __DIR__ . '/vendor/autoload.php';

// 设置每个连接接收的数据包最大为1024000字节
TcpConnection::$defaultMaxPackageSize = 1024000;

$worker = new Worker('websocket://0.0.0.0:8484');
$worker->onMessage = function(TcpConnection $connection, $data)
{
$connection->send('hello');
};
// 运行worker
Worker::runAll();

  • 暂无评论
×
🔝