Hacker News new | ask | show | jobs
by lvice 1495 days ago
We use an approach similar to what's described here: https://blexin.com/en/blog-en/build-scalable-and-resilient-a...

Using the Actor Model provided by Akka and an event sourced architecture does not fit very well with the request-response model of HTTP. Commands are usually issued in a fire-and-forget pattern, with resulting events being pushed to the client in a completely asynchronous way.

By using websockets via SignalR, we can better accomodate this pattern on the client code as well. On top of being a better fit with our backend architecture, it also provides some benefits in the frontend such as:

- Limited availability items disappear as soon as they actually are not available anymore, without the client having to refresh

- We can integrate more easily with payment gateways where payment confirmation usually arrives via a server side webhook. We can then easily push the "payment succeeeded" event to the client as soon as we receive it, without polling.

- Even the backoffice benefits from real-time, as all backoffice users are guaranteed that when they look up a customer/orders/products, they are looking at the most up-to-date information, even if somebody else edits the same record at the same time, or the record is updated by external APIs/scheduled job.

- We can provide easily real-time dashboboards that are listening to the feed of events being persisted