| Methods |
public
|
__construct(
non-empty-list<string> $command,
?string $workingDirectory = null,
null|array<string, string> $env = null,
LoggerInterface $logger = new NullLogger(),
int $maxLineBytes = LineReader::DEFAULT_MAX_LINE_BYTES,
SubprocessLauncherInterface $launcher = new AmpSubprocessLauncher(),
)
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, returning immediately.
Begins consuming inbound envelopes from the peer, returning immediately.
Implements
|
#
|
public
|
onUnexpectedExit(Closure $listener): ListenerHandleInterface
Registers a listener invoked with the peer's exit code (null when it reported none) when the transport
tears down without close(), after which the instance is spent and a supervisor builds a fresh one.
Registers a listener invoked with the peer's exit code (null when it reported none) when the transport
tears down without close(), after which the instance is spent and a supervisor builds a fresh one.
Implements
|
#
|
public
|
send(JsonRpcMessage $message, ?SendContext $context = null): void
Enqueues an outbound JSON-RPC message to the peer, close listeners firing before a write failure is rethrown.
Enqueues an outbound JSON-RPC message to the peer, close listeners firing before a write failure is rethrown.
Implements
|
#
|
public
|
close(): void
Closes the connection once, firing onClose() after the underlying streams close, which an
implementation MUST also do after a fatal error since Server::run() blocks on that signal.
A call from another fiber while a close is in progress MUST block until that close settles,
while one re-entering from the closing fiber returns immediately.
Closes the connection once, firing onClose() after the underlying streams close, which an
implementation MUST also do after a fatal error since Server::run() blocks on that signal.
A call from another fiber while a close is in progress MUST block until that close settles,
while one re-entering from the closing fiber returns immediately.
Implements
|
#
|
public
|
onMessage(Closure $listener): ListenerHandleInterface
A transport multiplexing several peers MUST namespace or rewrite inbound request ids before
emitting them, since the protocol layer correlates and cancels by id alone.
A transport multiplexing several peers MUST namespace or rewrite inbound request ids before
emitting them, since the protocol layer correlates and cancels by id alone.
Implements
|
#
|
public
|
onError(Closure $listener): ListenerHandleInterface
|
#
|
public
|
onDrain(Closure $listener): ListenerHandleInterface
Register a drain listener that fires before close().
Register a drain listener that fires before close().
Implements
|
#
|
public
|
onClose(Closure $listener): ListenerHandleInterface
|
#
|