2017-10-21 14:26:52 +00:00
|
|
|
## Overview
|
|
|
|
|
|
|
|
Read Protocol.md
|
|
|
|
|
|
|
|
## Dependencies
|
|
|
|
|
|
|
|
* Python 3
|
|
|
|
* pip3 install --user websockets
|
|
|
|
|
|
|
|
## Example usage
|
|
|
|
|
2021-03-10 03:43:27 +00:00
|
|
|
For dev usage, generate a self-signed certificate and run the server:
|
2017-10-21 14:26:52 +00:00
|
|
|
|
|
|
|
```console
|
2018-06-26 22:05:16 +00:00
|
|
|
$ ./generate_cert.sh
|
2020-08-09 20:06:54 +00:00
|
|
|
$ ./simple_server.py
|
2017-10-21 14:26:52 +00:00
|
|
|
```
|
|
|
|
|
2021-03-10 03:43:27 +00:00
|
|
|
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>`.
|
|
|
|
|
2018-11-22 05:23:15 +00:00
|
|
|
### Session Based
|
|
|
|
|
2021-03-10 03:43:27 +00:00
|
|
|
In two new consoles, run these two commands:
|
|
|
|
|
2017-10-21 14:26:52 +00:00
|
|
|
```console
|
2018-06-26 22:05:16 +00:00
|
|
|
$ ./session-client.py
|
2017-10-21 14:26:52 +00:00
|
|
|
Our uid is 'ws-test-client-8f63b9'
|
|
|
|
```
|
|
|
|
|
|
|
|
```console
|
2018-06-26 22:05:16 +00:00
|
|
|
$ ./session-client.py --call ws-test-client-8f63b9
|
2017-10-21 14:26:52 +00:00
|
|
|
```
|
2018-11-22 05:23:15 +00:00
|
|
|
### Room Based
|
|
|
|
|
2021-03-10 03:43:27 +00:00
|
|
|
Or, if you want to test rooms, run these two in two new consoles:
|
|
|
|
|
2018-11-22 05:23:15 +00:00
|
|
|
```console
|
|
|
|
$ ./room-client.py --room 123
|
|
|
|
Our uid is 'ws-test-client-bdb5b9'
|
|
|
|
Got ROOM_OK for room '123'
|
|
|
|
```
|
|
|
|
|
|
|
|
```console
|
|
|
|
$ ./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"}
|
|
|
|
```
|
|
|
|
|
2021-03-10 03:43:27 +00:00
|
|
|
You will see similar output with more clients in the same room.
|