add broker subscription
This commit is contained in:
@@ -27,6 +27,10 @@ auth_controller = AuthController(app, auth_data, "https://192.168.15.120:8000")
|
|||||||
client_controller = ClientController(app, auth_data, "https://192.168.15.120:8000")
|
client_controller = ClientController(app, auth_data, "https://192.168.15.120:8000")
|
||||||
message_controller = MessageController(app, auth_data, "https://192.168.15.120:8000")
|
message_controller = MessageController(app, auth_data, "https://192.168.15.120:8000")
|
||||||
|
|
||||||
|
|
||||||
|
def handle_message_received(topic:str, payload:str):
|
||||||
|
pass
|
||||||
|
|
||||||
def start_mqtt(data : AuthData):
|
def start_mqtt(data : AuthData):
|
||||||
client_id = data.get_client_id()
|
client_id = data.get_client_id()
|
||||||
|
|
||||||
@@ -46,10 +50,14 @@ def start_mqtt(data : AuthData):
|
|||||||
password="hepl",
|
password="hepl",
|
||||||
)
|
)
|
||||||
|
|
||||||
|
api_broker.subscribe(f"/chat/{client_id}/message", handle_message_received)
|
||||||
|
|
||||||
forwarder = MQTTForwarder(client_id, local_broker, api_broker)
|
forwarder = MQTTForwarder(client_id, local_broker, api_broker)
|
||||||
forwarder.start(f"/customer/telemetry/#", f"/board-mate/{client_id}/telemetry")
|
forwarder.start(f"/customer/telemetry/#", f"/board-mate/{client_id}/telemetry")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|
||||||
auth_controller.set_on_login(start_mqtt)
|
auth_controller.set_on_login(start_mqtt)
|
||||||
|
|||||||
Reference in New Issue
Block a user