Author Topic: MQTT QoS How Does it Work?  (Read 160 times)

Nick_W

  • Full Member
  • ***
  • Posts: 215
    • View Profile
MQTT QoS How Does it Work?
« on: January 12, 2017, 10:06:40 am »
Can anyone explain how the MQTT QoS setting works?

The reason I ask is that I'm not sure if this is controlling the connection between the module and the gateway, or the gateway and the MQTT server.

My gateway is not connecting to WiFi properly (after the last firmware upgrade - but this may be co-incidence), so I have connected it via Ethernet to my switch, which is in the basement. Now, some modules that are far away are only communicating sporadically.

Beacons mostly get through, but most (not all) MQTT messages are missed. I was wondering if changing the QoS setting would help. ie, does the module resend the MQTT message, if it does not get acknowledgment from the gateway (if QoS was set to QoS.AtLeastOnce), or does the module just "fire and forget", and the QoS setting is more to do with the gateway caching the message until it can confirm that the server has received it (in which case this is not of much use to me as it's hard wired).

Not sure why beacons would get through, but not mqtt messages - other than the fact that beacons are small, and mqtt messages are long...

Everything seems to work OK with the gateway centrally located, but WiFi either won't connect, or drops out (when it does connect) after a few hours (and doesn't reconnect).

Is there a warranty on the gateways? I've had it less than a year...

Share on Facebook Share on Twitter


mc-T2

  • Administrator
  • Sr. Member
  • *****
  • Posts: 252
  • mc-Things! The opportunities are endless!
  • Location: Canada
    • View Profile
Re: MQTT QoS How Does it Work?
« Reply #1 on: January 12, 2017, 12:54:58 pm »
Hey Nick_W,

QoS is only between the gateway and your MQTT broker, not between the modules at this time. We are working to implement QoS between the modules and the gateway down the road. You are correct that right now, the modules send their messages to the gateway but there is no guaranteed quality of service just yet.

Quote
Not sure why beacons would get through, but not mqtt messages - other than the fact that beacons are small, and mqtt messages are long...
This is most likely due to the frequency of beacons being sent. Due to the location of your gateway now, you are probably missing the same percentage of messages and beacons, but beacons are sent more often (in default mode) so it would appear that more of them are making it to the gateway.
We did just release new firmware today for the mcGateway and are soon to release a new mcGateway application processor. While the latest firmware updates should not have affected how the WIFI works on the gateway, I would suggest putting the latest updates onto your gateway (and modules) and then try to connect via WIFI again to see if it makes any difference.

Unfortunately, there is no warranty on the Kickstarter gateways110 as they are for development/experimental use. We do have the mcGateway110 available for purchase on our website right now.

We will be releasing the new mcGateway120 when available (more details to come soon) and that will have a standard manufacturers warranty. Thanks for your patience
Need more mc-Modules, mc-Gateways or other mc-Things? Check out our product page: www.mcthings.com/products. mc-Development kits are available too!
Check out a live Dashboard using mcThings and Losant! Click here: https://goo.gl/ST43hB

mc-John

  • Global Moderator
  • Full Member
  • *****
  • Posts: 212
    • View Profile
Re: MQTT QoS How Does it Work?
« Reply #2 on: January 15, 2017, 05:08:10 pm »
I can add some more information how this works. Messages from device to gateway are acknowledge and retried if the acknowledgement does not arrive. The gateway buffers that information and publishes that message based on the QoS. That works ok in most cases but some things still can go wrong.
  • When messages send by the module are not acknowledged after 5 retries by the gateway, the message is removed from the queue.
  • When the gateway is very busy and runs out of memory space that it has to throw out messages.
It looks to me that the first problem is happening.


Useful Useful x 1 View List