AS AgentScopeAPI 手册 / API Reference

OkHttpWebSocketConnection

public class OkHttpWebSocketConnection<T> implements WebSocketConnection<T>
源码Source io/agentscope/core/model/transport/websocket/OkHttpWebSocketConnection.java:35–197

Ok HTTP WebSocket 连接,与模型服务通信并返回生成或向量化结果。位于 io.agentscope.core.model.transport.websocket 包,实现 WebSocketConnection<T>。核心成员包括 send、receive、close、isOpen、getCloseInfo。

WebSocket connection implementation based on OkHttp WebSocket.

Supports both text (String) and binary (byte[]) message types through generic type parameter.

方法摘要Method Summary

方法Method说明Description
public Mono<Void> send(T data)
设置发送。
Performs the send operation.
public Flux<T> receive()
返回接收。
Returns the receive.
public Mono<Void> close()
关闭连接并释放相关资源。
Releases resources and connections.
public boolean isOpen()
判断是否打开。
Returns whether the open.
public CloseInfo getCloseInfo()
获取关闭信息。
Returns the close info.

方法详情Method Detail

send

public Mono<Void> send(T data)

设置发送。

Performs the send operation.

参数Parameters
名称Name类型Type说明Description
dataT数据(类型 `T`)。The data.
返回Returns Mono<Void>
返回Mono。Returns mono.
源码Source io/agentscope/core/model/transport/websocket/OkHttpWebSocketConnection.java:117–161

receive

public Flux<T> receive()

返回接收。

Returns the receive.

返回Returns Flux<T>
返回Flux。Returns flux.
源码Source io/agentscope/core/model/transport/websocket/OkHttpWebSocketConnection.java:163–173

close

public Mono<Void> close()

关闭连接并释放相关资源。

Releases resources and connections.

返回Returns Mono<Void>
返回Mono。Returns mono.
源码Source io/agentscope/core/model/transport/websocket/OkHttpWebSocketConnection.java:175–186

isOpen

public boolean isOpen()

判断是否打开。

Returns whether the open.

返回Returns boolean
返回布尔值,表示判断结果。Returns a boolean result.
源码Source io/agentscope/core/model/transport/websocket/OkHttpWebSocketConnection.java:188–191

getCloseInfo

public CloseInfo getCloseInfo()

获取关闭信息。

Returns the close info.

返回Returns CloseInfo
返回CloseInfo。Returns close info.
源码Source io/agentscope/core/model/transport/websocket/OkHttpWebSocketConnection.java:193–196
基于官方固定版本源码静态生成Generated from pinned official sources · Python 2.0.11 · Java 2.0.4
签名与文档为静态抽取;如有疑问请以源码为准。Signatures and docs are extracted statically; verify against the source when in doubt.