SwooleWorkerConfig
in package
Read onlyYes
FinalYes
Tags
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
$dispatchMode
public
int
$dispatchMode
$enableWebSocket
public
bool
$enableWebSocket
$host
public
string
$host
$installSignalHandlers
public
bool
$installSignalHandlers
$logFile
public
string
$logFile
$logger
public
LoggerInterface
$logger
$maxConn
public
int
$maxConn
$maxRequest
public
int
$maxRequest
$port
public
int
$port
$reactorThreads
public
int
$reactorThreads
$shutdownTimeout
public
Duration
$shutdownTimeout
$swooleSettings
public
array<string|int, mixed>
$swooleSettings
= []
$workers
public
int
$workers
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. UsewithSwooleSetting()to populate immutably.
bind()
public
static bind(string $host[, int $port = 8080 ]) : self
Parameters
- $host : string
- $port : int = 8080
Return values
selfdispatchMode()
public
dispatchMode(int $mode) : self
Parameters
- $mode : int
Return values
selfenableWebSocket()
public
enableWebSocket([bool $b = true ]) : self
Parameters
- $b : bool = true
Return values
selfinstallSignalHandlers()
public
installSignalHandlers(bool $b) : self
Parameters
- $b : bool
Return values
selflogFile()
public
logFile(string $path) : self
Parameters
- $path : string
Return values
selflogger()
public
logger(LoggerInterface $log) : self
Parameters
- $log : LoggerInterface
Return values
selfmaxConn()
public
maxConn(int $n) : self
Parameters
- $n : int
Return values
selfmaxRequest()
public
maxRequest(int $n) : self
Parameters
- $n : int
Return values
selfreactorThreads()
public
reactorThreads(int $n) : self
Parameters
- $n : int
Return values
selfshutdownTimeout()
public
shutdownTimeout(Duration $d) : self
Parameters
- $d : Duration
Return values
selfwithSwooleSetting()
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
selfworkers()
public
workers(int $n) : self
Parameters
- $n : int