B4J Question [MQTT] MQTT and Limits -> Creating an MQTT Extender

Magma

Expert
Licensed User
Longtime User
Hi there...

Well I am using MQTT a lot...

I ve found some limits that are made by design... or because of use...

The basic-feature and the same time limit is:
MQTT use for IoT and for short messages... The limit is the size of message (for example there are mqtt brokers-server that have 8KB ~ 2MB / message)

How about bypassing the limits of MQTT... by creating an extender for it... ?

The reason i am created "Tutorial" is because I am gonna use your opinions and thoughts (if you wanna share them with me) - to create a simple project...

For example Copy a big file to From one Device (pc) to other (pc)... (need to make it pieces and send one by one)

but the same time do other jobs too...

MQTT is asynchronous... So doing a job like this... need to make it synchronous-like - wait for packet to copied and verified that readed and then send the other....

First of all... do you know if there is any library, class doing that job ? - if "yes", there is no need of this thread...
 
Last edited:

Magma

Expert
Licensed User
Longtime User
As I am working (is too difficult as i see and not easy to make it in some hours) on this "Tutorial"... sharing thoughts..

the question: Where an MQTT synchronous mode can be used ?

What "I" mean with synchronous may be not the same with what is possible exists (something read about paho c client library, etc)... or may be is the same...

Let's have a Real Life Example...

First... let's say we have two clients (at a broker/mqtt server)...
One that will share Data of his DB when asked for (Client-A) and other (Client-B) that will ask/request for specific data from Client-A...

How works in when in asynchronous mode...

Client-A opens DB... and wait for messagearrive (the request from Client-B)
when see the request will send the data
* simple and clean...

but in real life - how the Client-B will get the data asked...
1) What if those data-resulset are so many (200MB) that will make all freeze or if mqtt broker not has the feature of so big messages -will not transfer...?
2) and if the data-resultset is ok to transfer... when will come to Client-B.. ? --need to check with --messagearrived-- (answer - but not this we want - right ?)

How will be working in synchronous mode or at the mode we will create... ?

Client-A opens DB... and wait for messagearrive (the request from Client-B)
when see the request will send the data
* simple and clean...

Client-B, Request for Data
Client-B, Wait for Data (waitfor)------------------------- ---> Imagine those commands in one "button sub" and no need to have check messsagearrived
Client-B, when all data arrived - show the data

* also imagine that at wait for will append all (possible) splitted bytes transferred from the other Client..



still working on all that... if someone has something to share - will be useful
 
Last edited:
Upvote 0

Magma

Expert
Licensed User
Longtime User
After some hours... of testing... did some progress... uploading a project to see

When Client-A request data from Client-B (that have the role of server - Be Server: true)...

Client-B sending data with splitting them as limitsizeraw set (at example have it at 100bytes... you can make it smaller or greater to play)
Client-A wait for all data and append bytes...
Client-A when all come... shows at log

Keys:... verify - limitsizeraw - request data

How this example will work:

Compile as stand alone... run two times: run_debug.bat

at first instance: ---> 1) uniqueid: myid1 2)Be Server 3) Start
at second instance: ---> 1) uniqueid: myid2 2) Start 3) Request Data from db server (this will ask for data from first instance)

/ Playing with limitsizeraw - can help with low bandwidth regions - slow internet or many clients.

ps: Caution! This is good example for only two connected mqtt client... if need more you must add Lists for receiving and sending data with id-of-row checking and appending data to any list raw..


I am pretty sure that can be better... and may be easier...
 

Attachments

  • DBviaMQTT.zip
    10.4 KB · Views: 117
Last edited:
Upvote 0
Top