| Methods |
public
|
__construct(
ReadableStream $stdin = new ReadableResourceStream(STDIN),
WritableStream $stdout = new WritableResourceStream(STDOUT),
LoggerInterface $logger = new NullLogger(),
int $maxLineBytes = LineReader::DEFAULT_MAX_LINE_BYTES,
)
|
#
|
public
|
start(): void
Begins consuming inbound envelopes from the peer. Returns immediately.
Begins consuming inbound envelopes from the peer. Returns immediately.
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
|
getSessionId(): ?string
Returns the transport-issued session identifier, or null when the
transport carries no session (e.g. stdio).
Returns the transport-issued session identifier, or null when the
transport carries no session (e.g. stdio).
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
|
#
|