Open bitfreak25 opened 8 years ago
@bitfreak25 Hello sir, How did you solved this issue ?
I used to use the mosquitto_loop_forever()
function from the underlying library to handle the reconnects, but unfortunately that means that the function never returns at all, so if you attempt to break out of the loop, throw an exception, or similar, PHP doesn't know about it. That means I need to reimplement the function myself, which I've done, but I didn't get to implementing all of the reconnection logic. That's on my to-do list, and I hope to have it ready to look at in the next few days. In the mean time I'm afraid you need to do it the long way in your own code.
I solved it by using a php-restart-script similar to an answer on stackoverflow. But for me this looks like a workaround, so it would be nice, if this will be implemented in the library itself.
As I tested reconnecting by using loopForever() and restarting the local mqtt-broker mosquitto, my script stops. The output was:
I expected a reconnect, but this wasn't the case. Whats wrong here?