Skip to main content

What Is Stream Mode

Stream mode is an integration method provided by the DingTalk Open Platform. It can listen for Bot callbacks, event subscription callbacks, and registered Card callbacks. When you integrate using Stream mode, the DingTalk Open Platform communicates with your app through a WebSocket connection. Stream mode greatly lowers the integration barrier and resource dependency. You do not need public network resources such as a server, IP address, or domain. Simply integrate the DingTalk Open Platform SDK.

Stream Mode Principles

In Stream mode, your app integrates the SDK to establish a WebSocket connection with the DingTalk Open Platform. During the connection process, the Open Platform authenticates the connection. When a Card callback occurs, the Open Platform pushes the data to your app through the WebSocket connection. Your app can receive this data and process it accordingly, enabling real-time communication with the DingTalk Open Platform, as shown in the figure below.

Advantages of Stream Mode

In scenarios where the DingTalk Open Platform sends requests to an app, most use the Webhook method (registering a public HTTPS service), including Card callbacks. Developing with the Webhook method involves many challenges, including:
  • Applying for a public domain and TLS certificate
  • Applying for a public IP address and deploying an access gateway
  • Deploying an application firewall and configuring an allowlist
  • Handling request authentication as well as encryption and decryption on your own
  • Setting up an intranet penetration environment for local development and debugging
To address these issues, Stream mode provides developers with a “five-zero” integration experience, reducing the integration development cycle from 1 to 2 weeks to 5 minutes, including:
  • Zero Public IP You do not need to rely on or expose a public IP address or domain. This reduces the security risks of exposing services to the public network and lowers the development barrier.
  • Zero Encryption/Decryption, Signature, or TLS Certificate Management Use the app identity to authenticate the connection and establish a TLS-encrypted connection with the DingTalk Open Platform through a reverse connection, providing a fast and secure communication experience.
  • Zero Firewall Allowlist In Stream mode, you do not need to open any server ports to the public network, deploy a firewall, or configure an allowlist.
  • Zero Gateway Deployment The channel is established through a reverse connection. You only need to ensure that the runtime environment has public network access. No gateway deployment is required.
  • Zero Intranet Penetration You do not need to set up intranet penetration tools locally. With Stream mode, you can receive Card callbacks directly in your local development environment.

Integration Methods

Important The Client-side receives callbacks for the corresponding Card as soon as it starts. When deploying test and development environments, avoid affecting the production environment.

Integration Limits

  1. The environment where your app is deployed must have public network access.
  2. Applicable only to internal apps and third-party enterprise apps.
  3. Each client instance enables one WebSocket connection by default, and an app can establish up to 50 connections by default.

Java

  • Runtime Environment

    JDK 1.8 or later.
  • Install the Java SDK

    Add the dependency to your project’s pom.xml file or download the corresponding JAR package. You can view and download the latest SDK version here.
  • Sample Code

    Bot Callback
    For details, see the Bot development documentation. Parameter Description Event Subscription Callback
    For details, see Configure Stream Push. Parameter Description Card Callback
    For details, see Interactive Card Stream. Parameter Description

Golang

  • Runtime Environment

    1.16 or later.
  • Install the SDK

  • Sample Code

    Bot Callback
    Parameter Description

Integration Methods in Other Languages

If you encounter any issues during the process, you can submit feedback and discuss questions through Technical Support.

Technical Support

If you have any questions during development, join the DingTalk Stream Mode Co-Creation Group for consultation and answers: Stream Mode Co-Creation Group.