Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

194
Views
The best way to refresh paginated data on the client side?

I have a REST API that implements server-side pagination returning the following data:

{
  items: [
    {
      id: 1,
      name: 1
    },
    {
      id: 2,
      name: 2
    }
  ],
  nextToken: <some-hash-key> // cursor-based
}

How should the client application refresh the list if the resource gets updated (client isn't aware of the update, so this is a pull model)? I have some ideas:

  1. fetch all resources at a regular interval (like every 10 seconds)
  2. maintain a session ID that rotates every N minutes. When a new session is created, fetch all resources

Both approaches are fundamentally the same idea. The first approach is more costly but allows more real-time updates. The second approach is based on session ID which I think is more idiomatic, but no real-time updates. Is there any other approach?

about 4 years ago · Juan Pablo Isaza
3 answers
Answer question

0

REST APIs are not designed for real time updates; for that you need sockets.

about 4 years ago · Juan Pablo Isaza Report

0

It is not scalable to update every single update to client-side in realtime, so it has to be an updation at regular interval. The duration/interval time could be decided based on facts on the table.

You can use simple integration like https://socket.io and a cron like architecture to broadcast updates in regular intervals.

about 4 years ago · Juan Pablo Isaza Report

0

Version your list, send If-None-Match request headers with GET requests each n secs, or probably mins. Respond with 304 if not modified. Respond with new data if modified. Though this won't scale well. Using websockets and sending an update event scales a lot better. As of sessions REST is stateless, so you don't have those.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!