From 373a2a31f6fb81088af2c9d91a5d199e0a1379e2 Mon Sep 17 00:00:00 2001 From: MingxuanGame Date: Fri, 22 Aug 2025 17:34:05 +0000 Subject: [PATCH] fix(signalr): use hub to send packet to trace packet --- app/signalr/hub/hub.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/app/signalr/hub/hub.py b/app/signalr/hub/hub.py index c39df64..daeba34 100644 --- a/app/signalr/hub/hub.py +++ b/app/signalr/hub/hub.py @@ -265,12 +265,13 @@ class Hub[TState: UserState]: logger.exception(f"Error invoking method {packet.target} for client {client.connection_id}") error = "Unknown error occured in server" if packet.invocation_id is not None: - await client.send_packet( + await self.send_packet( + client, CompletionPacket( invocation_id=packet.invocation_id, error=error, result=result, - ) + ), ) elif isinstance(packet, CompletionPacket): client._store.add_result(packet.invocation_id, packet.result, packet.error) @@ -289,14 +290,15 @@ class Hub[TState: UserState]: async def call(self, client: Client, method: str, *args: Any) -> Any: invocation_id = client._store.get_invocation_id() - await client.send_packet( + await self.send_packet( + client, InvocationPacket( header={}, invocation_id=invocation_id, target=method, arguments=list(args), stream_ids=None, - ) + ), ) r = await client._store.fetch(invocation_id, None) if r[1]: @@ -304,14 +306,15 @@ class Hub[TState: UserState]: return r[0] async def call_noblock(self, client: Client, method: str, *args: Any) -> None: - await client.send_packet( + await self.send_packet( + client, InvocationPacket( header={}, invocation_id=None, target=method, arguments=list(args), stream_ids=None, - ) + ), ) return None