Arduino MQTT Hang

Code is below in a paste bin.

I don't (can't) do rubbish bin. There is a perfectly good mechanism for posting code here, using the Additional Options link below the text entry window, if necessary.