API Index — Namespaces, Packages, Reports, Indices
FcgiCoroutineTransport
in package
implements
FcgiTransport
Coroutine-yielding FastCGI transport (#289) — OpenSwoole\Coroutine\Client.
Every send() / recv() yields under the OpenSwoole event loop, so the worker
is never blocked. Used ONLY when the dispatch already runs inside a coroutine
(Coroutine::getCid() >= 0) — e.g. an fcgi backend reached from a coroutine-mode
request. Outside a coroutine, FcgiBlockingTransport is used instead (the
coroutine client cannot even be constructed at getCid() < 0).
Table of Contents
Interfaces
- FcgiTransport
- Socket transport for {@see FastCgiClient} (#289).
Properties
- $buffer : string
- Read-ahead buffer.
OpenSwoole\Coroutine\Client::recv()returns ALL available bytes (its argument is a timeout, not a length), so a small fast response arrives in one segment. The FCGI framing reads EXACT lengths (8-byte header, then content), so we buffer whatrecv()returns and hand back at most the requested count — otherwiserecvExact(8)for the header would swallow the whole response and the body would be lost (#289). - $conn : Client|null
- $host : string
- $isUnix : bool
- $port : int
- $timeout : float
Methods
- __construct() : mixed
- close() : void
- Close the connection (idempotent).
- connect() : void
- Open the connection to the FastCGI backend.
- recv() : string
- Receive up to
$maxLenbytes. Returns''on a clean EOF (peer closed). - send() : void
- Send all bytes to the backend.
Properties
$buffer
Read-ahead buffer. OpenSwoole\Coroutine\Client::recv() returns ALL
available bytes (its argument is a timeout, not a length), so a small fast
response arrives in one segment. The FCGI framing reads EXACT lengths
(8-byte header, then content), so we buffer what recv() returns and hand
back at most the requested count — otherwise recvExact(8) for the header
would swallow the whole response and the body would be lost (#289).
private
string
$buffer
= ''
$conn
private
Client|null
$conn
= null
$host
private
string
$host
$isUnix
private
bool
$isUnix
$port
private
int
$port
$timeout
private
float
$timeout
Methods
__construct()
public
__construct(string $host, int $port, bool $isUnix, float $timeout) : mixed
Parameters
- $host : string
- $port : int
- $isUnix : bool
- $timeout : float
close()
Close the connection (idempotent).
public
close() : void
connect()
Open the connection to the FastCGI backend.
public
connect() : void
recv()
Receive up to $maxLen bytes. Returns '' on a clean EOF (peer closed).
public
recv(int $maxLen) : string
Parameters
- $maxLen : int
Return values
stringsend()
Send all bytes to the backend.
public
send(string $data) : void
Parameters
- $data : string