Commit a0281355 authored by Duggan, John's avatar Duggan, John
Browse files

Merge branch '93-webagg-setup-fails-in-python-3-11-and-newer' into 'main'

Pass tasks to asyncio.wait instead of coroutines

Closes #93

See merge request ndip/public-packages/nova-trame!68
parents 2025b0ac 1cabcb6c
Loading
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -6,7 +6,7 @@ Changelog = "https://code.ornl.gov/ndip/public-packages/nova-trame/blob/main/CHA

[tool.poetry]
name = "nova-trame"
version = "0.20.1"
version = "0.20.2"
description = "A Python Package for injecting curated themes and custom components into Trame applications"
authors = ["Duggan, John <dugganjw@ornl.gov>"]
readme = "README.md"
+4 −4
Original line number Diff line number Diff line
@@ -3,7 +3,7 @@
import json
import os
import socketserver
from asyncio import FIRST_COMPLETED, new_event_loop, set_event_loop, wait
from asyncio import FIRST_COMPLETED, create_task, new_event_loop, set_event_loop, wait
from io import BytesIO
from mimetypes import types_map
from pathlib import Path
@@ -188,9 +188,9 @@ class MatplotlibFigure(matplotlib.Figure):
                        raise ValueError("unexpected message type: %s", print(msg))

            # Forward websocket data in both directions
            await wait(
                [ws_forward(ws_server, ws_client), ws_forward(ws_client, ws_server)], return_when=FIRST_COMPLETED
            )
            server_to_client = create_task(ws_forward(ws_server, ws_client))
            client_to_server = create_task(ws_forward(ws_client, ws_server))
            await wait([server_to_client, client_to_server], return_when=FIRST_COMPLETED)
            await client_session.close()  # Ensure the connection is cleaned up when the Trame client disconnects.

            return ws_server