AS AgentScopeAPI 手册 / API Reference

CloseInfo

public record CloseInfo(int code, String reason)
源码Source io/agentscope/core/model/transport/websocket/CloseInfo.java:26–68

承载关闭信息数据的记录类型。位于 io.agentscope.core.model.transport.websocket 包。核心成员包括 code、reason、isNormal、normal、abnormal、NORMAL_CLOSURE。

WebSocket connection close information.

Contains the close code and reason when a WebSocket connection is closed.

记录组件摘要Record Component Summary

组件Component类型Type说明Description
codeint
执行 `code` 方法。
WebSocket close code
reasonString
执行推理相关操作。
Close reason message

字段摘要Field Summary

字段Field类型Type说明Description
NORMAL_CLOSURE
staticfinal
int
NORMAL CLOSURE字段。
Normal closure (1000).
GOING_AWAY
staticfinal
int
GOING AWAY字段。
Going away (1001).
PROTOCOL_ERROR
staticfinal
int
协议错误字段。
Protocol error (1002).
ABNORMAL_CLOSURE
staticfinal
int
ABNORMAL CLOSURE字段。
Abnormal closure (1006).

方法摘要Method Summary

方法Method说明Description
public boolean isNormal()
判断是否 `isNormal`。
Check if this is a normal closure.
public static CloseInfo normal(String reason)
static
设置该参数。
Create a CloseInfo for normal closure.
public static CloseInfo abnormal(String reason)
static
设置该参数。
Create a CloseInfo for abnormal closure.

记录组件详情Record Component Detail

code

int code

执行 code 方法。

WebSocket close code

源码Source io/agentscope/core/model/transport/websocket/CloseInfo.java:26–68

reason

String reason

执行推理相关操作。

Close reason message

源码Source io/agentscope/core/model/transport/websocket/CloseInfo.java:26–68

字段详情Field Detail

NORMAL_CLOSURE

public static final int NORMAL_CLOSURE
staticfinal

NORMAL CLOSURE字段。声明为 public static final int NORMAL_CLOSURE。

Normal closure (1000).

源码Source io/agentscope/core/model/transport/websocket/CloseInfo.java:29

GOING_AWAY

public static final int GOING_AWAY
staticfinal

GOING AWAY字段。声明为 public static final int GOING_AWAY。

Going away (1001).

源码Source io/agentscope/core/model/transport/websocket/CloseInfo.java:32

PROTOCOL_ERROR

public static final int PROTOCOL_ERROR
staticfinal

协议错误字段。声明为 public static final int PROTOCOL_ERROR。

Protocol error (1002).

源码Source io/agentscope/core/model/transport/websocket/CloseInfo.java:35

ABNORMAL_CLOSURE

public static final int ABNORMAL_CLOSURE
staticfinal

ABNORMAL CLOSURE字段。声明为 public static final int ABNORMAL_CLOSURE。

Abnormal closure (1006).

源码Source io/agentscope/core/model/transport/websocket/CloseInfo.java:38

方法详情Method Detail

isNormal

public boolean isNormal()

判断是否 isNormal。

Check if this is a normal closure.

返回Returns boolean
返回布尔值,表示判断结果。true if the close code is 1000 (normal closure)
源码Source io/agentscope/core/model/transport/websocket/CloseInfo.java:45–47

normal

public static CloseInfo normal(String reason)
static

设置该参数。

Create a CloseInfo for normal closure.

参数Parameters
名称Name类型Type说明Description
reasonString原因(类型 `String`)。Close reason
返回Returns CloseInfo
返回CloseInfo。CloseInfo instance
源码Source io/agentscope/core/model/transport/websocket/CloseInfo.java:55–57

abnormal

public static CloseInfo abnormal(String reason)
static

设置该参数。

Create a CloseInfo for abnormal closure.

参数Parameters
名称Name类型Type说明Description
reasonString原因(类型 `String`)。Close reason
返回Returns CloseInfo
返回CloseInfo。CloseInfo instance
源码Source io/agentscope/core/model/transport/websocket/CloseInfo.java:65–67
基于官方固定版本源码静态生成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.