Documentation / @agentick/mcp / RelayTransport
Class: RelayTransport
Defined in: client/relay-transport.ts:40
Implements
Transport
Constructors
Constructor
new RelayTransport(
options):RelayTransport
Defined in: client/relay-transport.ts:49
Parameters
options
Returns
RelayTransport
Properties
onclose()?
optionalonclose: () =>void
Defined in: client/relay-transport.ts:46
Callback for when the connection is closed for any reason.
This should be invoked when close() is called as well.
Returns
void
Implementation of
Transport.onclose
onerror()?
optionalonerror: (error) =>void
Defined in: client/relay-transport.ts:45
Callback for when an error occurs.
Note that errors are not necessarily fatal; they are used for reporting any kind of exceptional condition out of band.
Parameters
error
Error
Returns
void
Implementation of
Transport.onerror
onmessage()?
optionalonmessage: (message,extra?) =>void
Defined in: client/relay-transport.ts:44
Callback for when a message (request or response) is received over the connection.
Includes the requestInfo and authInfo if the transport is authenticated.
The requestInfo can be used to get the original request information (headers, etc.)
Parameters
message
JSONRPCMessage
extra?
MessageExtraInfo
Returns
void
Implementation of
Transport.onmessage
sessionId?
optionalsessionId:string
Defined in: client/relay-transport.ts:47
The session ID generated for this connection.
Implementation of
Transport.sessionId
setProtocolVersion()?
optionalsetProtocolVersion: (version) =>void
Defined in: client/relay-transport.ts:75
Sets the protocol version used for the connection (called when the initialize response is received).
Parameters
version
string
Returns
void
Implementation of
Transport.setProtocolVersion
Methods
close()
close():
Promise<void>
Defined in: client/relay-transport.ts:70
Closes the connection.
Returns
Promise<void>
Implementation of
Transport.close
receive()
receive(
message):void
Defined in: client/relay-transport.ts:65
Feed a message received from the relay layer (browser/iframe). Call this when the gateway/channel delivers a message from the remote end.
Parameters
message
JSONRPCMessage
Returns
void
send()
send(
message,_options?):Promise<void>
Defined in: client/relay-transport.ts:57
Sends a JSON-RPC message (request or response).
If present, relatedRequestId is used to indicate to the transport which incoming request to associate this outgoing message with.
Parameters
message
JSONRPCMessage
_options?
TransportSendOptions
Returns
Promise<void>
Implementation of
Transport.send
start()
start():
Promise<void>
Defined in: client/relay-transport.ts:53
Starts processing messages on the transport, including any connection steps that might need to be taken.
This method should only be called after callbacks are installed, or else messages may be lost.
NOTE: This method should not be called explicitly when using Client, Server, or Protocol classes, as they will implicitly call start().
Returns
Promise<void>
Implementation of
Transport.start