while not self.client.is_connected_to_host():
pass
# todo: Add in a timeout
while self.client.get_status() != StreamPeerTCP.STATUS_CONNECTED:
pass
print("Connected to server")
This should be something more like:
var timeout = 20
var timestep = 0.2
while not self.client.is_connected_to_host():
yield(get_tree().create_timer(timestep), "timeout")
timeout -= timestep
if timeout < 0:
return false
while self.client.get_status() != StreamPeerTCP.STATUS_CONNECTED:
yield(get_tree().create_timer(timestep), "timeout")
timeout -= timestep
if timeout < 0:
return false
The code here: https://github.com/DynamicDevices/godot-multi/blob/master/godot-multi/addons/mqtt/mqtt.gd#L90
has some bad busy infinite loops!
This should be something more like: