gstreamer/subprojects/gst-examples/webrtc/signalling
Matthew Waters 3e3ee9e6f5 examples/webrtc/signalling: Fix compatibility with Python 3.10
- ssl module requires an explicit TLS_SERVER role
- asyncio throws a deprecation warning when using
  asyncio.get_event_loop().  Remove custom event loop handling entirely
- No need to keep the websocket server in a member variable, can use
  a future to signal exit case along with the async with context manager
  of websockets.serve()

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2711>
2022-07-04 10:23:57 +01:00
..
Dockerfile Move files from gst-examples into the "subprojects/gst-examples/" subdir 2021-09-24 16:15:58 -03:00
generate_cert.sh Move files from gst-examples into the "subprojects/gst-examples/" subdir 2021-09-24 16:15:58 -03:00
meson.build Move files from gst-examples into the "subprojects/gst-examples/" subdir 2021-09-24 16:15:58 -03:00
Protocol.md Move files from gst-examples into the "subprojects/gst-examples/" subdir 2021-09-24 16:15:58 -03:00
README.md Move files from gst-examples into the "subprojects/gst-examples/" subdir 2021-09-24 16:15:58 -03:00
room-client.py Move files from gst-examples into the "subprojects/gst-examples/" subdir 2021-09-24 16:15:58 -03:00
session-client.py Move files from gst-examples into the "subprojects/gst-examples/" subdir 2021-09-24 16:15:58 -03:00
simple_server.py examples/webrtc/signalling: Fix compatibility with Python 3.10 2022-07-04 10:23:57 +01:00

Overview

Read Protocol.md

Dependencies

  • Python 3
  • pip3 install --user websockets

Example usage

For dev usage, generate a self-signed certificate and run the server:

$ ./generate_cert.sh
$ ./simple_server.py

If you want to use this server from the browser (to use the JS example, for instance), you will need to go to https://127.0.0.1:8443 and accept the self-signed certificate. This step is not required if you will be deploying on a server with a CA-signed certificate, in which case you should use ./simple_server.py --cert-path <cert path>.

Session Based

In two new consoles, run these two commands:

$ ./session-client.py
Our uid is 'ws-test-client-8f63b9'
$ ./session-client.py --call ws-test-client-8f63b9

Room Based

Or, if you want to test rooms, run these two in two new consoles:

$ ./room-client.py --room 123
Our uid is 'ws-test-client-bdb5b9'
Got ROOM_OK for room '123'
$ ./room-client.py --room 123
Our uid is 'ws-test-client-78b59a'
Got ROOM_OK for room '123'
Sending offer to 'ws-test-client-bdb5b9'
Sent: ROOM_PEER_MSG ws-test-client-bdb5b9 {"sdp": "initial sdp"}
Got answer from 'ws-test-client-bdb5b9': {"sdp": "reply sdp"}

You will see similar output with more clients in the same room.