fix: add pre_start() to _IncomingHandler for dingtalk SDK compatibility

The dingtalk-stream SDK calls pre_start() on every registered handler
before opening the WebSocket connection. Without this method, the SDK
raises AttributeError and kills the stream connection, causing DingTalk
to be unable to connect via Stream Mode.
This commit is contained in:
samggggflynn 2026-05-18 19:59:37 -07:00 committed by Teknium
parent 7267c38695
commit e3293c007f

View file

@ -1395,6 +1395,16 @@ class _IncomingHandler(
self._adapter = adapter
self._loop = loop
def pre_start(self) -> None:
"""No-op pre-start hook required by dingtalk-stream SDK.
The SDK calls ``pre_start()`` on every registered handler before
opening the WebSocket connection. Without this method, the SDK
raises ``AttributeError: '_IncomingHandler' object has no
attribute 'pre_start'`` and kills the stream connection.
"""
return
async def process(self, message: "CallbackMessage"):
"""Called by dingtalk-stream (>=0.20) when a message arrives.