mister.cake
mister.cake

Reputation: 165

Auto refresh JSON data pulled from server

I built an app that pulls JSON data from a server and displays it in rows. What is the best way, if left on this screen, to get it auto refresh and check the server for new JSON to display? The server that is supplying the JSON will update as updates come in.

Upvotes: 0

Views: 378

Answers (1)

devance
devance

Reputation: 61

From my experience, it is recommended to use Javascript by initializing roHTMLWidget in your file and get access to your server just like you are working with your browser. By doing so you can auto-refresh your JSON data at ease with setTimeout() function.

Another way to work with Javascript is to setup a websocket between the your hardware and the server. This way, your server can notify and send the data to your hardware right away without waiting for a regular time interval to refresh to data.

If you insist to use Brightscript instead, you may use roDatagramReceiver to receive data or using roUrlTransfer object with roTimer to send a request to your server regularly for update of JSON.

Upvotes: 1

Related Questions