Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

189
Vistas
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 Respuestas
Responde la pregunta

0

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

about 4 years ago · Juan Pablo Isaza Denunciar

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 Denunciar

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda