Join 4,000+ others and never miss out on new tips, tutorials, and more.
Latest version:
pecl install openswoole-22.1.2 | composer require openswoole/core:22.1.5
<?php OpenSwoole\Coroutine\Server->set(array $options): void
A key-value associative array of server options.
None
Set the server options for the coroutine server.
Options must be set before the server is started.
Length Agreement
<?php
$server = new OpenSwoole\Coroutine\Server('127.0.0.1', 8080);
$server->set([
'open_length_check' => true,
'package_max_length' => 1024 * 1024,
'package_length_type' => 'N',
'package_length_offset' => 0,
'package_body_offset' => 4,
]);
...
SSL Certificates
<?php
$server = new OpenSwoole\Coroutine\Server('127.0.0.1', 443, $ssl = true);
$server->set([
'ssl_cert_file' => dirname(__DIR__) . '/ssl/server.crt',
'ssl_key_file' => dirname(__DIR__) . '/ssl/server.key',
]);
...