Rating:
you just need to search for the right function used in the internet: https://techtutorialsx.com/2017/04/09/esp8266-connecting-to-mqtt-broker/ the flag is **client.loop()**
I don't remember