4 ms·
I appreciate some events can be asynchronous for clients, for example: actions taken by other users, or events generated by the system. However, I do think impl
by SpaghettiX 4y ago
I appreciate some events can be asynchronous for clients, for example: actions taken by other users, or events generated by the system. However, I do think implementation details (using async in the server) should be encapsulated from clients: when users save a new document, it's much easier for the client to receive a useful albeit delayed response, rather than "event submitted", wait for the result on a stream. Of course, other relevant clients may need to hear about that event too. The service architecture should not affect / make-life-harder for clients.
Therefore I think disagree with both parent and grandparent comments. Use each when they make sense, not "synchronous by default" (grandparent comment, though I do think there are good points made), or "asynchronous based on service architecture" (parent comment).
> But my better solution is to pull the async-ness all the way out to the client: https://matssocket.io/ https://matssocket.io/
Is that a solution that you use? I took a look at matssocket https://www.npmjs.com/package/matssocket https://www.npmjs.com/package/matssocket, it currently has 2 weekly downloads. :thinking:.
- stolsvik 4y agoTo make a point out of it: This is not event based in the event sourcing way of thinking. It is using messages. You put a message on a queue, someone else picks it up. Mats implements a request/reply paradigm on top ("messaging with a call stack"). In the interactive, synchronous situation, you do not "wait for an event" per se. You wait for a specific reply. When using the MatsFuturizer (https://mats3.io/docs/sync-async-bridge/ https://mats3.io/docs/sync-async-bridge/), it is extremely close to how you would have used a HttpClient or somesuch. MatsSocket: The Dart/Flutter implementation is used in a production mobile app. For the Norwegian market only, though. The JS implementation is used in an internal solution. Would have been really nice with a bit more usage, yes. It is actually pretty nice, IMHO! ;-)