Welcome to the Real-Time Chat project!. This project provides a real-time chat system using WebSockets technology with Django Channels and Redis for managing channels.
- Web Browser Client: Access the chat system through a web browser interface.
- Tkinter GUI Client: Interact with the chat system using a Tkinter-based graphical user interface.
- Script Launcher: Launch multiple instances of a basic Python client script to connect to the chat system.
Users can connect to their preferred chat room, including politics, economy, and off-topic discussions, and engage in real-time conversations.
Note: The following directory structure includes only the relevant folders and files.
-
clients: WebSocket clientsbasic_python_client.py: A basic python client for receive messages from server.client_launcher.py: Used to launch 10 instances of basic python client.tkinter_python_client.py: A Tkinter GUI python client for send and recive messages.
-
data_stream: Django WebSocket servertemplates: HTML templates folderbase.html: base layout.lobby.html: template for main page.chat_room.html: template for single chat room.
routing.py: WebSocket routing configuration.consumers.py: WebSocket consumer logic.urls.py: URL patterns for HTTP application.views.py: view functions for HTTP requests.
-
realtime_data_processing: Django settings foldersettings.py: Configuration settings for Django project.urls.py: URL patterns mapping URLs to views.
-
Dockerfile: Builds the Django server Docker image for the project. -
docker-compose.yml: Configures Docker services. -
manage.py: Manages Django project. -
requirements.txt: Lists Python dependencies for this project.
Before running this project, ensure you have the following installed:
- Python
- Docker
- Docker Compose
- websockets python library
Follow these steps to run the project:
-
Clone the repository:
git clone https://github.com/PanchoG17/realtime-chat.git -
Navigate to the project directory:
cd ./realtime_data_processing -
Run Docker Compose:
docker-compose up --build -
Access the application via client browser:
Open a web browser and go to http://localhost:8000. -
Navigate to the clients directory:
cd ./clients -
Launch the terminal clients:
python client_launcher.py- Enter your username and select a chat room from the available options.
- Creates 10 concurrent instances of the basic_python_client.py, each representing a separate client connection to the chat server.
- It only keep listening for incoming messages.
-
Accessing the Application via Tkinter GUI:
python tkinter_python_client.py- Enter your username and select a chat room from the available options.
- Click the "Connect" button to establish a connection to the chat server.
- It will automatically spawm simulated messages.
- Type your message in the text area and click "Send" to send messages to the chat room.
- Click the "Disconnect" button to end the chat session and disconnect from the server.