SwooleServerFactory
Creates the HTTP server SwooleRuntime binds and runs.
The seam that keeps the runtime testable: SwooleRuntime takes one of these optionally and falls back to NativeSwooleServerFactory, which builds a real Swoole\Http\Server and refuses when ext-swoole is absent. A test supplies its own implementation and gets a SwooleServerInterface double, so the host, port and settings the runtime computed can be asserted without the extension installed.
Implementors must return a server bound to the given host and port with $settings applied, ready for the runtime to attach its worker-start and request handlers to.
Synopsis
Section titled “Synopsis”interface SwooleServerFactory
| Implemented by | NativeSwooleServerFactory |
| Source | SwooleServerFactory.php |
Methods
Section titled “Methods”| Method | Description |
|---|---|
create(string $host, int $port, array<string, mixed> $settings): SwooleServerInterface |
create()
Section titled “create()”abstract public function create(string $host, int $port, array<string, mixed> $settings): SwooleServerInterface
Passed straight to Swoole’s set().
| Parameter | Type | Description |
|---|---|---|
$host | string | |
$port | int | |
$settings | array``<``string``, ``mixed``> | Passed straight to Swoole’s set(). |
Returns SwooleServerInterface