| Methods |
public
|
__construct(
non-empty-string $endpoint,
null|DelegateHttpClient $client = null,
LoggerInterface $logger = new NullLogger(),
float $readTimeout = 30.0,
int $maxResponseBytes = self::DEFAULT_MAX_RESPONSE_BYTES,
)
Parameters
| $endpoint |
Absolute URL of the server's MCP endpoint
|
| $client |
Defaults to the amphp default client
|
| $readTimeout |
Seconds a response may stall before the exchange is abandoned.
It must exceed the server's SSE keep-alive interval, or a quiet
long-lived stream is torn down between keep-alives.
|
| $maxResponseBytes |
Bytes a buffered body, or one SSE frame, may occupy
|
|
#
|
public
|
start(): void
Begins consuming inbound envelopes from the peer, returning immediately.
Begins consuming inbound envelopes from the peer, returning immediately.
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
|
#
|
public
|
abort(RequestId $id): void
Stops whatever this transport still has in flight for $id: a no-op for an id it does not hold, never
reported through onError(), and no substitute for the protocol layer's notifications/cancelled.
Stops whatever this transport still has in flight for $id: a no-op for an id it does not hold, never
reported through onError(), and no substitute for the protocol layer's notifications/cancelled.
Implements
|
#
|