This is a real-time chat application built with Python (Tornado) backend and a sleek, futuristic HTML/CSS/JS frontend. It features WebSocket communication for instant messaging and a modern, responsive user interface.
- Real-time messaging using WebSockets
- Sleek, futuristic user interface
- Random username assignment
- Distinguishes between user's own messages and others'
Before you begin, ensure you have met the following requirements:
- Python 3.7 or higher installed
- pip (Python package manager) installed
- Clone this repository or download the source code.
git clone https://github.com/sarmadgulzar/tornado-chat-app.git
cd tornado-chat-app
- Create a virtual environment (recommended):
python3 -m venv venv
- Activate the virtual environment:
- On Windows:
venv\Scripts\activate
- On macOS and Linux:
source venv/bin/activate
- Install the required packages:
pip install -r requirements.txt
Ensure your project directory looks like this:
tornado-chat-app/
│
├── main.py
└── templates/
└── chat.html
- Start the server:
python main.py
By default, the server will run on http://localhost:8888
. You can specify a different port using the --port
option:
python chat_server.py --port=8000
-
Open a web browser and navigate to
http://localhost:8888
(or the port you specified). -
You should see the chat interface. The application will automatically assign you a random username.
-
Open multiple browser windows or tabs to simulate different users chatting.
- Type your message in the input field at the bottom of the chat window.
- Press the "Send" button or hit Enter to send your message.
- Your messages will appear on the right side of the chat window.
- Messages from other users will appear on the left side.
- To modify the user interface, edit the
chat.html
file in thetemplates
directory. - To change server behavior or add new features, modify the
chat_server.py
file.
If you encounter any issues:
- Ensure all prerequisites are installed correctly.
- Check that you're running the correct Python version.
- Verify that the
tornado
package is installed in your virtual environment. - Make sure no other applications are using the specified port.