Maybe try and connect with an MQTT client on a local computer first to check it works?
It's also worth noting that Espruino on ESP8266 won't do TLS (needed for secure MQTT), which I guess could be causing you problems?
@Gordon started
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
Maybe try and connect with an MQTT client on a local computer first to check it works?
It's also worth noting that Espruino on ESP8266 won't do TLS (needed for secure MQTT), which I guess could be causing you problems?