Class DingTalkStreamClient

java.lang.Object
io.agentscope.extensions.channel.dingtalk.DingTalkStreamClient

public final class DingTalkStreamClient extends Object
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

  1. POST {streamRegisterUrl} with appKey, appSecret, and the topic subscription list. Response includes endpoint (wss URL) and ticket.
  2. Connect WebSocket to endpoint?ticket=ticket.
  3. 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 Details

  • 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.