Android Question Is something like SyncLock necessary/ available in B4A

RJB

Active Member
Licensed User
Longtime User
Hi @Peter Simpson. I haven't look at it yet, Erel has just suggested that I do so in another thread.
The messages will come from multiple 8266's at about 10 second intervals from each. I don't know what "MQTT.QOS_2_EXACTLY_ONCE or better still MQTT.QOS_2_EXACTLY_ONCE" are (I can't actually see the difference between the two?).
@Erel, Probably best if I take a look at MQTT or MQTT.QOS_2_EXACTLY_ONCE, etc. so that I understand exactly how it works, thanks.
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
@Erel, Probably best if I take a look at MQTT or MQTT.QOS_2_EXACTLY_ONCE, etc. so that I understand exactly how it works, thanks.
You always seem to be ignoring my answers. You don't need to do anything special.
I will write it again:

No. Your code always run on the main thread. Messages will arrive one after another.
 
Upvote 0

Peter Simpson

Expert
Licensed User
Longtime User
@RJB,
You should really try to read and understanding what Erel is saying, if you don't quite under his (or anyone else's) answers then just ask a followup question.

Google as well as Bind are great services and guess what, they are 100% free to use as a normal user https://assetwolf.com/learn/mqtt-qos-understanding-quality-of-service.

If a forum member has already answered your question in another thread, then you posting the same question (or a variant of it) in a new post really is just wasting your own time as you might just get the same answer again...
 
Upvote 0

RJB

Active Member
Licensed User
Longtime User
I'm sorry but I just said that I would read up on MQTT. I didn't say that I did didn't understand or believe the answer - just that I didn't know anything about MQTT and needed to read up on it! I think it's only fair that I do that before asking follow up questions that could be avoided by me doing some reading, don't you?

Peter, thanks for the information, presumably you meant "QOS Level 1 - at least once or better still QOS Level 2 - exactly once" rather than "MQTT.QOS_2_EXACTLY_ONCE or better still MQTT.QOS_2_EXACTLY_ONCE" in #2.

I wasn't aware anybody else had asked that question, If they have then I apologise for the duplication.
 
Upvote 0

RJB

Active Member
Licensed User
Longtime User
Just in case anybody reads this and is considering using B4R and MQTT for an App that requires reliable communication:
Please read: https://www.b4x.com/android/forum/threads/mqtt-qos-and-errors.108862/ , it may save you wasted effort.
B4R only allows publish as QOS 0, hence the comments above about QOS 1/2 are misleading and anything published by the B4R client will be sent at QOS 0
Publish can't be set but defaults to 0. Which means that setting a subscriber to 1 or 2 has no effect, overall the connection will be QOS 0
Further information from https://www.hivemq.com/blog/mqtt-essentials-part-6-mqtt-quality-of-service-levels/
"QoS level 0 is often called “fire and forget” and provides the same guarantee as the underlying TCP protocol" and "Use QoS 0 when …You have a completely or mostly stable connection between sender and receiver. A classic use case for QoS 0 is connecting a test client or a front end application to an MQTT broker over a wired connection".
 
Upvote 0
Top