public class WebSocketSolonAcpClientTransport extends java.lang.Object implements AcpClientTransport
Messages are exchanged as JSON-RPC messages over WebSocket text frames.
Key features:
| 限定符和类型 | 字段和说明 |
|---|---|
static java.lang.String |
DEFAULT_ACP_PATH
Default path for ACP WebSocket endpoints
|
| 构造器和说明 |
|---|
WebSocketSolonAcpClientTransport(java.net.URI serverUri,
McpJsonMapper jsonMapper)
Creates a new WebSocketAcpClientTransport with the specified server URI and JsonMapper.
|
| 限定符和类型 | 方法和说明 |
|---|---|
reactor.core.publisher.Mono<java.lang.Void> |
closeGracefully()
Closes the transport connection and releases any associated resources
asynchronously.
|
reactor.core.publisher.Mono<java.lang.Void> |
connect(java.util.function.Function<reactor.core.publisher.Mono<AcpSchema.JSONRPCMessage>,reactor.core.publisher.Mono<AcpSchema.JSONRPCMessage>> handler)
Used to register the incoming messages' handler and potentially (eagerly) connect
to the agent.
|
WebSocketSolonAcpClientTransport |
connectTimeout(java.time.Duration timeout)
Sets the connection timeout for WebSocket establishment.
|
reactor.core.publisher.Mono<java.lang.Void> |
sendMessage(AcpSchema.JSONRPCMessage message)
Sends a message to the peer asynchronously.
|
void |
setExceptionHandler(java.util.function.Consumer<java.lang.Throwable> handler)
Sets the exception handler for exceptions raised on the transport layer.
|
<T> T |
unmarshalFrom(java.lang.Object data,
TypeRef<T> typeRef)
Unmarshals the given data into an object of the specified type.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitclose, protocolVersionspublic static final java.lang.String DEFAULT_ACP_PATH
public WebSocketSolonAcpClientTransport(java.net.URI serverUri,
McpJsonMapper jsonMapper)
serverUri - The WebSocket URI to connect to (e.g., "ws://localhost:8080/acp")jsonMapper - The JsonMapper to use for JSON serialization/deserializationpublic WebSocketSolonAcpClientTransport connectTimeout(java.time.Duration timeout)
timeout - The connection timeoutpublic reactor.core.publisher.Mono<java.lang.Void> connect(java.util.function.Function<reactor.core.publisher.Mono<AcpSchema.JSONRPCMessage>,reactor.core.publisher.Mono<AcpSchema.JSONRPCMessage>> handler)
AcpClientTransportconnect 在接口中 AcpClientTransporthandler - a transformer for incoming messagesMono that terminates upon successful client setup. It can mean
establishing a connection (which can be later disposed) but it doesn't have to,
depending on the transport type. The successful termination of the returned
Mono simply means the client can now be used. An error can be retried
according to the application requirements.public reactor.core.publisher.Mono<java.lang.Void> sendMessage(AcpSchema.JSONRPCMessage message)
AcpTransportThis method handles the transmission of messages to the peer in an asynchronous manner. Messages are sent in JSON-RPC format as specified by the ACP protocol.
sendMessage 在接口中 AcpTransportmessage - the AcpSchema.JSONRPCMessage to be sent to the peerMono that completes when the message has been sentpublic reactor.core.publisher.Mono<java.lang.Void> closeGracefully()
AcpTransportcloseGracefully 在接口中 AcpTransportMono that completes when the connection has been closed.public void setExceptionHandler(java.util.function.Consumer<java.lang.Throwable> handler)
AcpClientTransportsetExceptionHandler 在接口中 AcpClientTransporthandler - Allows reacting to transport level exceptions by the higher layerspublic <T> T unmarshalFrom(java.lang.Object data,
TypeRef<T> typeRef)
AcpTransportunmarshalFrom 在接口中 AcpTransportT - the type of the object to unmarshaldata - the data to unmarshaltypeRef - the type reference for the object to unmarshal