B4J Library MqttBroker

Status
Not open for further replies.
jMqttBroker library is based on the moquette open source project: https://github.com/andsel/moquette

It implements a MQTT broker. If you are not familiar with MQTT then start with this tutorial: https://www.b4x.com/android/forum/threads/59471/#content

The broker is like a "black box". It is responsible for managing the clients and routing the messages.

With this library you can embed the broker inside your app instead of using an external broker.

Note that this library can also be used with B4A. You can turn any Android or Linux board to a MQTT broker.
With B4A you need to add the INTERNET permission with the manifest editor:
B4X:
AddPermission(android.permission.INTERNET)

Using this library is simple:
B4X:
Sub Process_Globals
   Dim broker As MqttBroker
End Sub

Sub AppStart (Args() As String)
   broker.Initialize("", 51041) 'first parameter is the event name. It is currently not used.
   broker.DebugLog = True
   broker.Start
   StartMessageLoop 'Non-UI app
End Sub

jMQTTBroker V1: www.b4x.com/b4j/files/moqueutte.zip

jMQTTBroker v2 based on moquette v0.12 (December 2018) is available here: www.b4x.com/b4j/files/jMqttBroker2.zip
Unlike v1, the new version is not compatible with B4A.

Updates:

V2.02 - Fixes a compatibility issue with B4JPackager 11.
V2.01 - Changes an internal auto-flush timeout that caused delays.
 
Last edited:

udg

Expert
Licensed User
Longtime User
Hi @Erel ,
just an update about current jBroker component.
1. Is QOS level 2 available and working?
2. Is SSL available?

Anyway, is it planned a major update of the component in the near future or do you advice on setting up a full mosquitto (or similar) deploy for a real world project?

Thank you.

udg
 

narek adonts

Well-Known Member
Licensed User
Longtime User
hi,

how to prevent user A to subsxribe to TOPIC B for example.

I think that if the broker xould raise some events like, onSubscribe, onConnect, onPublish,... and like in jSerber Filters allowing with return True or False.

For exemlle I am trying to implement a chat server and I need to send a push notification if the user is offline. but i need to see Events for this. would be great to have some events for the broker
 
Status
Not open for further replies.

Similar Threads

Top