A real-time terminal-based chat application with support for private messaging, colorized usernames, and an interactive UI. Built with Python's socket programming and threading capabilities.
- 🌐 Real-time group chat
- 📱 Private messaging with
@usernamesyntax - 🎨 Colorized usernames for better message distinction
- ⌨️ Interactive terminal UI with hotkeys
- 🕒 Message timestamps
- 👤 Unique username validation
- 🔄 Clean disconnection handling
- Python 3.6+
- Windows OS (for interactive terminal features)
- Required Python packages:
- keyboard (for hotkey handling)
- All other dependencies are from Python's standard library
- Clone the repository:
git clone https://github.com/shahzaibahmad05/python-chat-app.git
cd python-chat-app- Install dependencies:
pip install -r requirements.txt- Start the server:
python server.py [host] [port]Default: host=127.0.0.1, port=55555
- Launch the client in a different terminal:
python client.py- Chat Interface Controls:
- Press 'a' to type a new message
- Press 'ESC' to exit
- Type '@username message' for private messages
- Use '/quit' to leave the chat
- Multi-threaded TCP server handling multiple concurrent clients
- Thread-safe client management with proper cleanup
- Broadcast and private message routing
- Username uniqueness enforcement
- ANSI color support for usernames
- Interactive terminal UI with real-time updates
- Separate thread for receiving messages
- Clean shutdown handling
- Message history display
- Hotkey-based input system
- TCP-based communication
- UTF-8 encoded messages
- Newline-delimited messages
- Special command prefixes:
- '@' for private messages
- '/quit' for disconnection
Feel free to open issues or submit pull requests with improvements. Some areas for potential enhancement:
- File transfer support
- Message persistence
- Emoji support
- Server commands/moderation
- Chat rooms/channels
- End-to-end encryption
This project is open source and available under the MIT License.