P postasat Active Member Licensed User Longtime User Apr 24, 2020 #1 Hi, I would like to use "MQTT Chat with Auto Discovery" with internet cloud service. I tried with the free service on https://www.maqiatto.com with the following code: B4X: Copy client.Initialize("client", "tcp://maqiatto.com:8883", "android" & Rnd(1, 10000000)) Dim mo As MqttConnectOptions mo.Initialize("my username", "my password") client.Connect2(mo) but I have a connection error (success=false): "Error connecting: (MqttException) Unexpected error (6)" Click to expand... How can I solve it ? Do you know a simple way to connect to a free MQTT cloud service ? Thank you.
Hi, I would like to use "MQTT Chat with Auto Discovery" with internet cloud service. I tried with the free service on https://www.maqiatto.com with the following code: B4X: Copy client.Initialize("client", "tcp://maqiatto.com:8883", "android" & Rnd(1, 10000000)) Dim mo As MqttConnectOptions mo.Initialize("my username", "my password") client.Connect2(mo) but I have a connection error (success=false): "Error connecting: (MqttException) Unexpected error (6)" Click to expand... How can I solve it ? Do you know a simple way to connect to a free MQTT cloud service ? Thank you.
barx Well-Known Member Licensed User Longtime User Apr 25, 2020 #2 I believe the use of port 8883 is default for secure connections. Try changing B4X: Copy "tcp://maqiatto.com:8883" to B4X: Copy "ssl://maqiatto.com:8883" Upvote 0
I believe the use of port 8883 is default for secure connections. Try changing B4X: Copy "tcp://maqiatto.com:8883" to B4X: Copy "ssl://maqiatto.com:8883"
P postasat Active Member Licensed User Longtime User Apr 26, 2020 #3 Hi, the correct code is with port 1883. B4X: Copy client.Initialize("client", "tcp://maqiatto.com:1883", "android" & Rnd(1, 10000000)) Dim mo As MqttConnectOptions mo.Initialize("my username", "my password") client.Connect2(mo) Now I can connect, but when I push "start server", the code doesn't open chat page. And if I start another phone as client, the button "Connect As Client" remains disabled. Maybe the autodiscovery function is not made for mqtt cloud server ? Upvote 0
Hi, the correct code is with port 1883. B4X: Copy client.Initialize("client", "tcp://maqiatto.com:1883", "android" & Rnd(1, 10000000)) Dim mo As MqttConnectOptions mo.Initialize("my username", "my password") client.Connect2(mo) Now I can connect, but when I push "start server", the code doesn't open chat page. And if I start another phone as client, the button "Connect As Client" remains disabled. Maybe the autodiscovery function is not made for mqtt cloud server ?