Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How to get an updated data automaticaly

I’m sorry in advance I don’t have a friend to ask this newbie question

I’m new and still learning all about API and in my way of learning it I already imagine
what I’m going to build, like that child on Twitter who monitor where the plane of mr beast
goes to but how to automatically get the updated API flight, do I need hard code it every time?

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

You can do it in two ways I think.

First, you can request the API (like GET: myApi.com/flights) every X seconds, get the data and update your app. Note that this method can be very heavy in term of data width and bandwidth.
This method is called Long-polling.

The other method is to use websockets, wich is a way to synchronize your app and an API without having to request it every X seconds.
You simply create a tunnel between your app and the API, and push messages on it. The app on the other side of the tunnel is constantly listening and is available to handle the messages (with some code you have written).

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading