Smart Push-to-Talk (PTT) Web Application for Real-Time Class Discussions using Websockets.
+------------+ +------------+
| Client 1 | ........ | Client n |
| | | |
+------------+ +------------+
| |
------------------------
|
v
+----------------------+
| WebSocket Server |
| |
+----------------------+
We recommend configuring a virtual environment for this project.
cdto the project rootpython3 -m venv venvsource venv/bin/activate- In your IDE, configure the Python interpreter to use the virtual environment
- For initial setup, do
pip install -r requirements.txt
Running the server:
- Connect the computer to a network/router. Then locate the public IP address of the computer
- If the computer runs a window OS, type “ipconfig” in the terminal and find the IPv4 address of “Wireless LAN adapter Wi-Fi:”
- If the computer runs a linux/unix OS, type “ifconfig” in the terminal and find the public IP address of the device
-
Go to chrome://flags/
-
Look for "Insecure origins treated as secure" and enable it
-
Add the ip address of the computer to the box and relaunch chrome. The reason for this is that our server does not use any certificate (i.e starts with http instead of https). Because of this, google chrome does not allow microphone to be enabled for unsecure webpage. This is to make google chrome “recognise” our webpage as secure.
-
Locate the file JSWebsocketClient.js. The folder path is server > static. Go to line 35, which have this line of code:
websocket = new WebSocket('ws://192.168.43.75:80/mic/' + name);
Note that 192.168.43.75 is only for our side. It could be different IP address
- Modify 192.168.43.75 to be the ip address of the computer
E.g If my IP address is 192.158.41.2, it’ll be
websocket = new WebSocket('ws://192.158.41.2:80/mic/' + name);
- Go to the folder containing the main.py file. This file should be in the server folder. Ensure the terminal’s path is this folder.
E.g <.../CS3103-A4-Grp51/server>
- Type into the terminal this command
uvicorn main:app --host (IP of computer) --port 80
For e.g, if my IP address is 192.158.41.2, the command is
uvicorn main:app --host 192.158.41.2 --port 80
- You should be able to see this (note that the weblink will be different. It only appears as 0.0.0.0 on my device) at the bottom. Click on the link to access the webpage
|--------------------------------------------------------------------------|
| ... |
|INFO: Started server process [22084] |
|INFO: Waiting for application startup. |
|INFO: Application startup complete. |
|INFO: Uvicorn running on http://0.0.0.0:8000 (Press CTRL+C to quit) |
|--------------------------------------------------------------------------|