Long connection (WebSocket) refers to a persistent, bidirectional communication channel initiated and maintained by the developer’s server to WeCom.
If you want to quickly integrate OpenClaw via long connection, please refer to: Integrate OpenClaw via Long Connection.
1. Secure handshake: Establishes a connection based on the wss:// protocol, with built-in encryption at the underlying layer. The business layer does not need to handle complex message encryption and decryption.
2. Credential subscription: After the connection is established, the aibot_subscribe command must be sent, completing identity verification using the robot’s unique BotID and Secret.
3. Heartbeat Keep-Alive: As it is a persistent connection, developers need to periodically (recommended every 30 seconds) send a heartbeat (ping) to prevent the connection from being terminated by the gateway.
4. Native streaming response: Perfectly matches the typing-style output effect of Large Language Models (LLM). Developers can push content in segments until setting finish=true to end the streaming output, eliminating the need for frequent refreshing.
Please securely store your Bot ID and Secret, and do not disclose them to others easily.
If you are a developer, you can refer to: WeCom Developer Documentation