AS AgentScopeAPI 手册 / API Reference

DingTalkStreamClient

public final class DingTalkStreamClient
源码Source io/agentscope/extensions/channel/dingtalk/DingTalkStreamClient.java:58–305

DingTalk 流客户端,封装与远端服务的连接和调用。位于 io.agentscope.extensions.channel.dingtalk 包。核心成员包括 start、stop、DingTalkStreamClient。

DingTalk Stream client — opens a long-lived WebSocket to the DingTalk gateway, subscribes to the bot-messages topic, and dispatches inbound frames to a consumer. Reconnects with exponential backoff on failure.

Stream protocol summary

  • POST {streamRegisterUrl} with appKey, appSecret, and the topic subscription list. Response includes endpoint (wss URL) and ticket.

  • Connect WebSocket to endpoint?ticket=ticket.

  • Each frame is a JSON envelope; type=CALLBACK carries a stringified data JSON. We must ACK each callback so DingTalk releases the message from its retry buffer.

This client is intentionally small — no external SDK dependency, no schema validation beyond what's required. Heartbeat / ping is left to the JDK WebSocket implementation.

构造器摘要Constructor Summary

构造器Constructor说明Description
public DingTalkStreamClient(DingTalkChannelProperties properties, Consumer<JsonNode> messageConsumer)
初始化 `DingTalkStreamClient` 实例。
Creates a new instance.

方法摘要Method Summary

方法Method说明Description
public void start()
执行启动相关操作。
Starts the stream connection.
public void stop()
执行停止相关操作。
Stops the stream connection and releases resources.

构造器详情Constructor Detail

DingTalkStreamClient

public DingTalkStreamClient(DingTalkChannelProperties properties, Consumer<JsonNode> messageConsumer)

初始化 DingTalkStreamClient 实例。

Creates a new instance.

参数Parameters
名称Name类型Type说明Description
propertiesDingTalkChannelProperties属性(类型 `DingTalkChannelProperties`)。The properties.
messageConsumerConsumer<JsonNode>消息消费者(类型 `Consumer`)。The message consumer.
源码Source io/agentscope/extensions/channel/dingtalk/DingTalkStreamClient.java:82–86

方法详情Method Detail

start

public void start()

执行启动相关操作。

Starts the stream connection.

源码Source io/agentscope/extensions/channel/dingtalk/DingTalkStreamClient.java:89–94

stop

public void stop()

执行停止相关操作。

Stops the stream connection and releases resources.

源码Source io/agentscope/extensions/channel/dingtalk/DingTalkStreamClient.java:97–115
基于官方固定版本源码静态生成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.