Home » Javascript » How to refresh efficiently and periodically the contents of a bootstrap 4 table from a rest API?

How to refresh efficiently and periodically the contents of a bootstrap 4 table from a rest API?

Posted by: admin August 19, 2018 Leave a comment

Questions:

I would like to refresh a Bootstrap v4 table (https://getbootstrap.com/docs/4.0/content/tables) based on the values fetched from the server side, for example a REST API resource.

I am currently struggling with the different approaches below:

  • Websockets
  • Webworker
  • Recursive setTimeout + ajax polling
  • Any other and better solution?

My main requirement would be something that is refreshed every 500 ms or less (e.g. stock prices).

Also I am wondering how to handle the most efficiently possible the DOM rendering of the table.

Answers: