MQTT Protocol¶
IoT-friendly protocol with multi-subscriber support - perfect for distributed systems.
Overview¶
MQTT (Message Queuing Telemetry Transport) provides: - ✅ Multi-subscriber support - ✅ IoT-friendly architecture - ✅ Broker-based messaging - ✅ Quality of Service levels
Default Port¶
1883 (broker port)
Requirements¶
MQTT Broker¶
Install and start Mosquitto:
# macOS
brew install mosquitto
mosquitto -c mosquitto.conf
# Linux
sudo apt-get install mosquitto
mosquitto -c mosquitto.conf
Python¶
Broker Configuration¶
Create mosquitto.conf:
Quick Start¶
Start Broker¶
Python Server¶
import asyncio
from arvos.servers import MQTTArvosServer
async def main():
server = MQTTArvosServer(host="localhost", port=1883)
server.on_imu = lambda data: print(f"IMU: {data}")
await server.start()
asyncio.run(main())
iOS App¶
- Open ARVOS app
- Select MQTT protocol
- Enter broker IP and port 1883
- Connect!
Features¶
Multi-Subscriber¶
- Multiple Python servers can subscribe
- Same data to all subscribers
- Distributed processing
Topics¶
arvos/telemetry- JSON sensor dataarvos/binary- Binary data (camera, depth)
Quality of Service¶
- QoS 0: At most once
- QoS 1: At least once
- QoS 2: Exactly once
Use Cases¶
- IoT deployments
- Multiple receivers
- Distributed systems
- Broker-based architectures
Advantages¶
- ✅ Multi-subscriber support
- ✅ IoT-friendly
- ✅ Reliable delivery (QoS)
- ✅ Standard protocol
Limitations¶
- ⚠️ Requires broker setup
- ⚠️ Additional infrastructure
- ⚠️ Broker can be bottleneck
Example¶
See MQTT Example
Next Steps¶
- Protocol Comparison
- HTTP/REST Protocol - Simpler alternative