I’m trying to make connection to HiveMQ cloud from Arduino, but get a connection failed with state “-2”. In the cluster details only ports 8883 (TLS) and 8884 (Websocket + TLS) are specified, but all the Arduino examples seem to use port 1883, e.g. Arduino PubSubClient - MQTT Client Library Encyclopedia.
You are trying to connect to HiveMQ Cloud with the default MQTT port (1883). HiveMQ Cloud only allows the ports 8883 (TLS) and 8884 (Websocket + TLS). This is why your connection fails.
Or do I need to do additional steps to be able to connect to TLS?
HiveMQ Cloud now has a guide on how to connect with Arduino ESP8266. You can find it under Cluster Details > Getting Started > Arduino ESP8266. I hope this helps you
For others looking for the correct link, you need a HiveMQ Cloud account and then can find the info on https://console.hivemq.cloud/clients/arduino-esp8266?uuid={YOUR_CLOUD_ID}