WebSockets vs SSE vs API polling
WebSockets SSE API pollingin the trade-off explorer →
WebSockets is 2 way open connection.
SSE (Server Sent Events) is one way.
API usually have a timeout of 30-60 seconds, configured by an outside system, often.
If the operation you're doing will take more than 5-10 seconds, it's best to make it async.
APIs can be done async if you poll, or you can keep an open connection
When is polling better? Why is it more simple? Doesn't need to keep the connection open? Which one has less load on server?
Referenced by
- Common System Design PatternsGrowing
Database Replication and read replicas. Something something geolocalisation. Postgres has extensions for this.