0

AIO With FONA A push model?
Moderators: adafruit_support_bill, adafruit

Forum rules
If you're posting code, please make sure your code does not include your Adafruit IO Active Key or WiFi network credentials.
Please be positive and constructive with your questions and comments.

AIO With FONA A push model?

by treyco on Thu Jan 30, 2020 10:24 pm

I’m just trying to understand using Arduino with FONA as a AIO client. My understanding of MQTT is that it pushes published data to subscribers through a persistent TCP pipe. I’m using the MQTT FONA example project. Everything hooks up and works. However, I’m noticing that this line in code takes approximately 500 milliseconds to execute even if there is no new data.

Code: Select all | TOGGLE FULL SIZE
 while ((subscription = mqtt.readSubscription(10)))


I’m using a millis timer in the loop to make sure I don’t violate the rate, but I don’t understand why checking for new data would count against my rate and why it takes so long to execute if it’s push technology.

treyco
 
Posts: 6
Joined: Wed Jan 29, 2020 9:47 am

Re: AIO With FONA A push model?

by brubell on Fri Jan 31, 2020 12:12 pm

but I don’t understand why checking for new data would count against my rate


the readSubscription function performs an Adafruit IO MQTT API (https://io.adafruit.com/api/docs/mqtt.h ... o-mqtt-api) action which counts against your data rate.



However, I’m noticing that this line in code takes approximately 500 milliseconds to execute even if there is no new data.


It's usually quicker with WiFi, there could be a delay to reach the Adafruit IO MQTT broker over cellular depending on your proximity to cell towers.

brubell
 
Posts: 745
Joined: Fri Jul 17, 2015 10:33 pm

Re: AIO With FONA A push model?

by treyco on Fri Jan 31, 2020 12:29 pm

So back to my original question. Does this mean that the adafruit implementation of MQTT is a polling model? I was under the impression that it was a push model.

treyco
 
Posts: 6
Joined: Wed Jan 29, 2020 9:47 am

Please be positive and constructive with your questions and comments.