Patterns for Building Realtime Features

Realtime features in apps enhance collaboration by sharing user-triggered changes instantly. Key patterns include:

  1. Poke/Pull: Server notifies clients (poke) to fetch new data (pull). Easy integration but causes simultaneous requests (fan-out), which can be mitigated with caching.

  2. Push State: Server sends entire updated state immediately. Reduces fan-out but can overwhelm clients with data and doesn't scale well for large states.

  3. Push Ops: Server sends specific operations instead of full state, enabling clients to update efficiently. Requires initial state fetching.

  4. Event Sourcing: Server sends events instead of state, requiring client-side logic to apply changes. Promotes reusable business logic but adds complexity.

  5. Transports: Options include websockets, SSE, and polling. Challenges arise in horizontally scaled systems regarding server-client coordination, solvable via Pub/Sub infrastructures.

https://zknill.io/posts/patterns-for-building-realtime/

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top