Re:Everybody gets WebSockets
by sametmax on Thursday May 05, 2016 @12:50PM
(#11637712)
There is more to this trade off, because push enables many neat things:
- you can halves the number of DB requests by 2 because refreshing is done by message passing half of the time instead of making a new requets trigerring DB calls.
- cache invalidation is pro-active, and linked to events instead of just time.
- you can have much more live stuff: settings, routing, configuration in general. You only need to load it once from your store, after that, any update is propagated. A CMS becomes cheap.
- making clients talk to each others is easy.
- websocket don't have CORS issues. You client code can query your live site, or a local backend, and synchronize both.
- you can use the same canal of communication between your user clients and internal (micro-services) clients. The architecture becomes simpler.
- if you have a heavy authentication process and complex sessions data, they can now be store with the persistent connection instead of being queried for every request.
Of course, not all that is enabled by default. You need to use some framework such as crossbar.io or meteorjs to get those benefits for free. Yet, it's very sweet.
- you can halves the number of DB requests by 2 because refreshing is done by message passing half of the time instead of making a new requets trigerring DB calls. - cache invalidation is pro-active, and linked to events instead of just time. - you can have much more live stuff: settings, routing, configuration in general. You only need to load it once from your store, after that, any update is propagated. A CMS becomes cheap. - making clients talk to each others is easy. - websocket don't have CORS issues. You client code can query your live site, or a local backend, and synchronize both. - you can use the same canal of communication between your user clients and internal (micro-services) clients. The architecture becomes simpler. - if you have a heavy authentication process and complex sessions data, they can now be store with the persistent connection instead of being queried for every request.
Of course, not all that is enabled by default. You need to use some framework such as crossbar.io or meteorjs to get those benefits for free. Yet, it's very sweet.