| Methods |
public
|
__construct(
list<string> $command,
?string $workingDirectory = null,
null|array<string, string> $env = null,
LoggerInterface $logger = new NullLogger(),
int $maxLineBytes = LineReader::DEFAULT_MAX_LINE_BYTES,
)
Parameters
| $command |
Subprocess argv (no shell interpretation).
|
| $env |
Subprocess environment (null prunes to a safe allowlist).
|
|
#
|
public
|
start(): void
Begins consuming inbound envelopes from the peer. Returns immediately.
Begins consuming inbound envelopes from the peer. Returns immediately.
Implements
|
#
|
public
|
onUnexpectedExit(Closure $listener): SubscriptionInterface
Registers a listener invoked with the peer's exit code when the transport tears down without
close() having been called, whether the peer exited on its own or stopped serving and was
killed. Calling close() notifies nobody. The reporting instance is spent once this fires: a supervisor respawns by building a fresh
transport, not by restarting this one. The exit code is null when the peer ended without
reporting a status.
Registers a listener invoked with the peer's exit code when the transport tears down without
close() having been called, whether the peer exited on its own or stopped serving and was
killed. Calling close() notifies nobody. The reporting instance is spent once this fires: a supervisor respawns by building a fresh
transport, not by restarting this one. The exit code is null when the peer ended without
reporting a status.
Implements
|
#
|
public
|
send(JsonRpcMessage $message, ?SendContext $context = null): void
Enqueues an outbound JSON-RPC message to the peer. On write failure, close listeners fire before the exception is rethrown.
Enqueues an outbound JSON-RPC message to the peer. On write failure, close listeners fire before the exception is rethrown.
Implements
|
#
|
public
|
close(): void
Closes the connection. The onClose() listener fires once after the
underlying streams are closed. Subsequent calls are no-ops. Implementations MUST guarantee that onClose() listeners fire after a
fatal error too, not only after explicit close(). Server::run()
blocks on the close signal, so a transport that raises errors without
eventually closing would hang the server loop.
Closes the connection. The onClose() listener fires once after the
underlying streams are closed. Subsequent calls are no-ops. Implementations MUST guarantee that onClose() listeners fire after a
fatal error too, not only after explicit close(). Server::run()
blocks on the close signal, so a transport that raises errors without
eventually closing would hang the server loop.
Implements
|
#
|
public
|
onMessage(Closure $listener): SubscriptionInterface
Register an inbound-envelope listener.
Register an inbound-envelope listener.
Implements
|
#
|
public
|
onError(Closure $listener): SubscriptionInterface
Register an error listener.
Register an error listener.
Implements
|
#
|
public
|
onDrain(Closure $listener): SubscriptionInterface
Register a drain listener that fires before close().
Register a drain listener that fires before close().
Implements
|
#
|
public
|
onClose(Closure $listener): SubscriptionInterface
Register a close listener.
Register a close listener.
Implements
|
#
|