B4J Question BANanoMQTT is very good,I have a problem, please help!

joulongleu

Active Member
Licensed User
Longtime User
I recently studied MQTT and found that BANanoMQTT is very happy
:)1.BANano6.11 Demo example, there are the following questions
:)2.because of BANanoMQTT Only Websockets are supported, can you support MQTT\TCP ? Thanks:)
1606432204551.png
 

alwaysbusy

Expert
Licensed User
Longtime User
From a web browser you can ONLY use MQTT over Websockets, not native MQTT (over TCP).
This is because the browser will not let you open a normal socket for security reasons.

If the iot.eclipse.org broker is down, here is an alternative to test:
B4X:
Dim clientId As String = "BananoMQTT" & Rnd(1,9999999999)
mqtt.Initialize("mqtt", "mqtt.eclipse.org",80, "/mqtt", False, clientId) ' note: the path MUST be /mqtt for this test server
      
Dim ops As BANanoMQTTConnectOptions
ops.Initialize("", "")
ops.CleanSession = False
mqtt.Connect2(ops)

Alwaysbusy
 
Last edited:
Upvote 0

joulongleu

Active Member
Licensed User
Longtime User
Can already be connected to MQTT:), but it will be interrupted by itself, you can add MqttConnectOptions.setAutomaticReconnect(boolean)? ?Thank You.
1606616616630.png
 
Last edited:
Upvote 0
Top