Route Definition
Basic Route Syntax
from core.router import Router
from app.controllers.sensor_controller import SensorController
router = Router()
# Basic route definition
router.on("sensors/temperature", SensorController.handle_temperature)Route Components
Topic Pattern
# Static topic - matches exactly
router.on("devices/status", handler)
# Parameterized topic - matches dynamic values
router.on("devices/{device_id}/status", handler)
# Multi-level topic - matches nested structures
router.on("sensors/{type}/{location}/data", handler)Handler Function
Route Options
Quality of Service (QoS)
Shared Subscriptions
Middleware
Topic Pattern Matching
Wildcards
Pattern Examples
Complete Route Example
Handler Function Signature
Best Practices
Topic Naming
Route Organization
Performance Considerations
Next Steps
Last updated