Requesting chunks from the Textual app

This commit is contained in:
Darren Burns
2024-08-13 14:58:54 +01:00
parent 12aecf708c
commit 0e6158f33c

View File

@@ -422,11 +422,20 @@ class GanglionClient(Handlers):
async def on_request_deliver_chunk(
self, packet: packets.RequestDeliverChunk
) -> None:
"""The Ganglion server requested a chunk of a file."""
"""The Ganglion server requested a chunk of a file. Forward that to the running app session.
When the meta is sent to the Textual app, it will be handled inside the WebDriver.
"""
route_key = RouteKey(packet.route_key)
session_process = self.session_manager.get_session_by_route_key(route_key)
if session_process is not None:
await session_process.send_meta({"type": "deliver_file_chunk"})
await session_process.send_meta(
{
"type": "deliver_chunk_request",
"key": packet.delivery_key,
"size": packet.chunk_size,
}
)
async def on_session_open(self, packet: packets.SessionOpen) -> None:
route_key = packet.route_key