Android Question cloudMQTT

derez

Expert
Licensed User
Longtime User
I'm trying to get the MQTT server from cloudMQTT work for me (while everything works with my home mqtt server).
I see in their documentation :
You are sometimes forced to format a connection URL while connecting via client libraries, it should look like mqtt://user:password@server:port .
I put the data of my project there in this b4a line:
B4X:
Private link As String = "mqtt://tfmntyfc:[email protected]:19289"
I get error in the initialization line:
B4X:
  client.Initialize("client",link, "WT"&Rnd(1,10000 ) )
*** Service (starter) Create ***
Error occurred on line: 19 (Starter)
java.lang.IllegalArgumentException: mqtt://tfmntyfc:[email protected]:19289
at org.eclipse.paho.client.mqttv3.MqttConnectOptions.validateURI(MqttConnectOptions.java:470)
at org.eclipse.paho.client.mqttv3.MqttAsyncClient.<init>(MqttAsyncClient.java:273)
at org.eclipse.paho.client.mqttv3.MqttAsyncClient.<init>(MqttAsyncClient.java:167)
at anywheresoftware.b4j.objects.MqttAsyncClientWrapper.Initialize(MqttAsyncClientWrapper.java:42)
...

Changed to tcp instead of mqtt, with this it passes the initialization but fails on client.connect, I get success = false in client_connect sub:
** Activity (main) Resume **
permit audio
(UnknownHostException) java.net.UnknownHostException: tfmntyfc:[email protected]
(UnknownHostException) java.net.UnknownHostException: tfmntyfc:[email protected]
Error occurred on line: 46 (Starter)
java.lang.reflect.InvocationTargetException
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.shell.Shell.runGoodChain(Shell.java:463)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:285)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:249)
at java.lang.reflect.Method.invoke(Native Method)
...

With ssl it is the same as in tcp.

Help please !
 

Peter Simpson

Expert
Licensed User
Longtime User
mqtt://user:password@server:port

Have you tried port 12100 or port 14925?
 
Upvote 0

derez

Expert
Licensed User
Longtime User
No, this is what I have for my instance


upload_2018-8-29_6-42-49.png


Tried the other ports as well with the same results.
 

Attachments

  • upload_2018-8-29_6-42-5.png
    upload_2018-8-29_6-42-5.png
    26.9 KB · Views: 259
Last edited:
Upvote 0
Top