maxPackageSize
Description:
static int Connection::$defaultMaxPackageSize
This attribute is a global static property used to set the maximum package length that can be received by each connection. If not set, it defaults to 10MB.
If the parsed data packet (the return value of the protocol class's input method) results in a package length greater than Connection::$defaultMaxPackageSize, it will be considered invalid data, and the connection will be closed.
Example
use Workerman\Worker;
use Workerman\Connection\TcpConnection;
require_once __DIR__ . '/vendor/autoload.php';
// Set the maximum packet size received by each connection to 1024000 bytes
TcpConnection::$defaultMaxPackageSize = 1024000;
$worker = new Worker('websocket://0.0.0.0:8484');
$worker->onMessage = function(TcpConnection $connection, $data)
{
$connection->send('hello');
};
// Run the worker
Worker::runAll();