Nexus API Reference

SwooleWorkerConfig
in package

Read onlyYes
FinalYes
Tags
psalm-api

Immutable configuration for SwooleWorkerServer::run(). Constructed via the static bind() entry; further tunables return new instances via PHP 8.5 clone-with.

Table of Contents

Properties

$dispatchMode  : int
$enableWebSocket  : bool
$host  : string
$installSignalHandlers  : bool
$logFile  : string
$logger  : LoggerInterface
$maxConn  : int
$maxRequest  : int
$port  : int
$reactorThreads  : int
$shutdownTimeout  : Duration
$swooleSettings  : array<string|int, mixed>
$workers  : int

Methods

__construct()  : mixed
bind()  : self
dispatchMode()  : self
enableWebSocket()  : self
installSignalHandlers()  : self
logFile()  : self
logger()  : self
maxConn()  : self
maxRequest()  : self
reactorThreads()  : self
shutdownTimeout()  : self
withSwooleSetting()  : self
Merge raw Swoole server settings (e.g. re-enable `websocket_compression` on a zlib-enabled build, tune `buffer_output_size`, set `ssl_cert_file`).
workers()  : self

Properties

Methods

__construct()

public __construct(string $host, int $port, int $workers, int $reactorThreads, int $maxRequest, int $maxConn, int $dispatchMode, Duration $shutdownTimeout, bool $installSignalHandlers, LoggerInterface $logger, string $logFile, bool $enableWebSocket[, array<string, mixed> $swooleSettings = [] ]) : mixed
Parameters
$host : string
$port : int
$workers : int
$reactorThreads : int
$maxRequest : int
$maxConn : int
$dispatchMode : int
$shutdownTimeout : Duration
$installSignalHandlers : bool
$logger : LoggerInterface
$logFile : string
$enableWebSocket : bool
$swooleSettings : array<string, mixed> = []

Extra keys merged into $server->set(). Applied BEFORE the framework's own defaults so those defaults win on conflict — except keys the framework does not set (e.g. websocket_compression), which you can override here. Use withSwooleSetting() to populate immutably.

bind()

public static bind(string $host[, int $port = 8080 ]) : self
Parameters
$host : string
$port : int = 8080
Return values
self

dispatchMode()

public dispatchMode(int $mode) : self
Parameters
$mode : int
Return values
self

enableWebSocket()

public enableWebSocket([bool $b = true ]) : self
Parameters
$b : bool = true
Return values
self

installSignalHandlers()

public installSignalHandlers(bool $b) : self
Parameters
$b : bool
Return values
self

logFile()

public logFile(string $path) : self
Parameters
$path : string
Return values
self

logger()

public logger(LoggerInterface $log) : self
Parameters
$log : LoggerInterface
Return values
self

maxRequest()

public maxRequest(int $n) : self
Parameters
$n : int
Return values
self

reactorThreads()

public reactorThreads(int $n) : self
Parameters
$n : int
Return values
self

withSwooleSetting()

Merge raw Swoole server settings (e.g. re-enable `websocket_compression` on a zlib-enabled build, tune `buffer_output_size`, set `ssl_cert_file`).

public withSwooleSetting(array<string, mixed> $settings) : self
Parameters
$settings : array<string, mixed>
Return values
self

workers()

public workers(int $n) : self
Parameters
$n : int
Return values
self
On this page

Search results