Android Question Okhttp (or) Mqtt

I want to get data every 3 seconds from api link!

1 . Okhttpjob + Timer
2 . MQTT

Which is better?
How much data, I think it depends, I've used MQTT some time ago, to receive a map of numbers every second.

Walter
 
Upvote 0
Upvote 0
It sounds the data provider is like a webserver, perhaps websocket is an option.
 
Upvote 0
I wnat to get data real-time data from api.

If you create both ends of the communication (I mean both the API and the client), and If I were you, I would prefer MQTT which is more light-weighted. If you don't, and you just consume the API, then as it is already said in this thread it depends on the API plus the latency of the server. And you might also consider some policies by several ISPs / Cloud providers that tend to ban IPs with lots of HTTP requests.
 
Upvote 0
"On my server, I use Node.js with MQTT to fetch data from an external site every 5 seconds. The Node.js process is running under PM2. My publisher app connects to the MQTT broker. When many users connect to the publisher app, is it possible for the server to encounter errors?"
 
Upvote 0
Back
Top