Been moving into some task oriented UI as a part of my CQRS implementation.
The problem is I have come across the need to update additional properties in my UI as a result of a change made by an initial command sent from the same UI.
My case is different but here’s an example…
eg. CommandA Add item to cart resulted in the following events (which all need to be reflected on the UI)
- change to store inventory
- add item to shopping cart
- change total with sales tax
What’s the best way to handle this without baking my business logic into my UI?
- return a list of resulting events that were performed as a result to the initial command?
- return a DTO that reflects changes
- other ideas?
I haven’t completed it yet, but my idea is to use a Hub from the SignalR framework and subscribe to events and act on them. As long as you can correlate user guids with the connected user guids in SignalR, you can send updates to the correct client and even detect if they still are there.
SignalR isn’t that mature yet but the tests I have done works pretty good.
I use it with Knockoutjs and I just update my view models and call functions.