An open API service indexing awesome lists of open source software.

https://github.com/niewidzialny84/tip_project

A simple voice communicator in python
https://github.com/niewidzialny84/tip_project

python study-project voice-chat

Last synced: about 2 months ago
JSON representation

A simple voice communicator in python

Awesome Lists containing this project

README

          

# TIP_Project
A simple voice communicator in python for a studies project created in teams of two

## Installing requirements
The intentional way of installing dependencies is running `pip install -r requirements.txt` command. However installation of PyAudio on Windows systems might result in error. If it does, then download appropriate binary file form [here](https://www.lfd.uci.edu/~gohlke/pythonlibs/#pyaudio). For example if you have python 3.9.1 64-bit version you want to download `PyAudio‑0.2.11‑cp39‑cp39‑win_amd64.whl` file.

It is highly recomended to use virtual enviroment

## Running the server
Server can be run by executing command
```
python Server/run.py
```
where the port variable is optional and default port is `9999`. Port also can be set using enviroment variable named `PORT`. Server runs on all interfaces.

## Running the client
Client UI can be run from the realsed package from [here](https://github.com/Niewidzialny84/TIP_Project/releases) or using the python command
```
python Client/client.py
```

## Communication schema
The server and client communicates using both TCP and UDP sockets where TCP is used as control to the connection, the UDP is used as voice delivery. Both apps share the same package wraping utility tool. TCP packages contain json values.
### Default communication schema
By default to be allowed for proper communication some values must me established in a simple exchange:
1. Client connects to socket, sends nickname
2. Server recives nickname adds it to connected users table and sends to all clients updated client list
3. Server responds to a nickname sending sessionID
4. Client sends binded UDP port where voice datagrams will be transfered
5. Communication can begin, voice packets are tranfered between users on UDP sockets
6. (Optionally) Server disconnects or client disconnects sending respective packages

### Table of packages
All presented packages contain `KEY` value which is used as a number describing package name.


Package Name
Required Values
Optional values
JSON Example


ACK




{"KEY": 0}




UNKNOWN_ERROR




{"KEY": 1}




SEND_NICKNAME
NAME



{"KEY": 2, "NAME": "John"}




SEND_NEW_USERS
USERS



{"KEY": 3, "USERS": ["John","Adam"]}




DISCONNECT

REASON


{"KEY": 4, "REASON": "Quit"}




SERVER_CLOSE




{"KEY": 5}




SESSION
SESSION



{"KEY": 6, "SESSION": 2}




CLIENT_PORT
PORT



{"KEY": 7, "PORT": 5253}