feat(signalr): support on_client_connect hook

This commit is contained in:
MingxuanGame
2025-07-27 16:23:47 +00:00
parent 4b02225c83
commit fb610c4898
2 changed files with 11 additions and 1 deletions

View File

@@ -1,5 +1,6 @@
from __future__ import annotations
import asyncio
import json
import time
from typing import Literal
@@ -92,4 +93,7 @@ async def connect(
if error or not client:
await websocket.close(code=1008)
return
task = asyncio.create_task(hub_.on_connect(client))
hub_.tasks.add(task)
task.add_done_callback(hub_.tasks.discard)
await hub_._listen_client(client)