A Python-based chat application using MQTT for real-time messaging and file transfer capabilities.
- Real-time messaging between users
- File transfer support
- Message queueing for offline users
- Client address discovery
- Direct messaging capabilities
- Python 3.7+
- paho-mqtt
- Clone the repository:
git clone [repository-url]
cd mqtt-chat-app- Create and activate a virtual environment:
python -m venv .venv
source .venv/bin/activate # On Windows: .venv\Scripts\activate- Install dependencies:
pip install paho-mqttTo start the chat server:
python src/chat_app.py serverThe server will start and listen for incoming connections on the default MQTT port (1883).
To start a chat client with a username:
python src/chat_app.py [username]Replace [username] with your desired username.
Once connected as a client, the following commands are available:
-
Send Message: Sends a message to the specified user.
send <username> <message>Example:
send alice Yooo, wassaup homie? -
Send File: Sends a file to the specified user.
file <username> <filepath>Example:
file bob /path/to/document.pdf -
Request User Address: Requests the client ID for the specified username.
address <username>Example:
address charlie -
Quit Application: Exits the chat application.
quit