Class DingTalkStreamClient
java.lang.Object
io.agentscope.extensions.channel.dingtalk.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}withappKey,appSecret, and the topic subscription list. Response includesendpoint(wss URL) andticket.- Connect WebSocket to
endpoint?ticket=ticket. - Each frame is a JSON envelope;
type=CALLBACKcarries a stringifieddataJSON. 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
ConstructorsConstructorDescriptionDingTalkStreamClient(DingTalkChannelProperties properties, Consumer<com.fasterxml.jackson.databind.JsonNode> messageConsumer) -
Method Summary
-
Constructor Details
-
DingTalkStreamClient
public DingTalkStreamClient(DingTalkChannelProperties properties, Consumer<com.fasterxml.jackson.databind.JsonNode> messageConsumer)
-
-
Method Details
-
start
public void start()Starts the stream connection. Safe to call once. -
stop
public void stop()Stops the stream connection and releases resources.
-