docs: enhance README with detailed listenKey auto-renewal process and error handling

- Updated the README to clarify the listenKey auto-renewal mechanism, including the use of `stream.recv()` for message reception.
- Added information on immediate reconnection upon detecting internal error payloads to prevent zombie connections.
This commit is contained in:
21in7
2026-03-02 16:43:45 +09:00
parent 52affb5532
commit a8cba2cb4c
2 changed files with 11 additions and 2 deletions

View File

@@ -43,7 +43,16 @@ class UserDataStream:
try:
async with bm.futures_user_socket() as stream:
logger.info(f"User Data Stream 연결 완료 (심볼 필터: {self._symbol})")
async for msg in stream:
while True:
msg = await stream.recv()
if isinstance(msg, dict) and msg.get("e") == "error":
logger.warning(
f"웹소켓 내부 에러 수신: {msg.get('m', msg)}"
f"재연결을 위해 연결 종료"
)
break
await self._handle_message(msg)
except asyncio.CancelledError: