fix: move mqtt_client.on_message assignment under function definition

This commit is contained in:
ishak jmilou.ishak
2025-01-09 12:47:39 +01:00
parent 612af45f59
commit a2aa80804e

View File

@@ -24,6 +24,9 @@ mqtt_client.connect("localhost", 1884, 60)
mqtt_client.loop_start() mqtt_client.loop_start()
mqtt_client.subscribe("kobuki/data") mqtt_client.subscribe("kobuki/data")
mqtt_client.on_message = on_message # this line needs to be under the function definition otherwise it can't find which function it needs to use
# Database connectie-functie # Database connectie-functie
def get_db(): def get_db():
if 'db' not in g: # 'g' is specifiek voor een request en leeft zolang een request duurt if 'db' not in g: # 'g' is specifiek voor een request en leeft zolang een request duurt