examples/webrtc/signalling: Fix compatibility with Python 3.10
authorSam Van Den Berge <sam.van.den.berge@gmail.com>
Mon, 17 Oct 2022 08:39:18 +0000 (10:39 +0200)
committerSam Van Den Berge <sam.van.den.berge@gmail.com>
Mon, 17 Oct 2022 09:46:51 +0000 (11:46 +0200)
Fix asyncio throwing a deprecation warning when using
asyncio.get_event_loop().

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3196>

subprojects/gst-examples/webrtc/signalling/room-client.py
subprojects/gst-examples/webrtc/signalling/session-client.py

index e82a3f2..b779a19 100755 (executable)
@@ -98,7 +98,7 @@ async def hello():
 print('Our uid is {!r}'.format(PEER_ID))
 
 try:
-    asyncio.get_event_loop().run_until_complete(hello())
+    asyncio.run(hello())
 except websockets.exceptions.InvalidHandshake:
     print('Invalid handshake: are you sure this is a websockets server?\n')
     raise
index d7d0f3e..9df1d5f 100755 (executable)
@@ -78,7 +78,7 @@ async def hello():
 print('Our uid is {!r}'.format(PEER_ID))
 
 try:
-    asyncio.get_event_loop().run_until_complete(hello())
+    asyncio.run(hello())
 except websockets.exceptions.InvalidHandshake:
     print('Invalid handshake: are you sure this is a websockets server?\n')
     raise