You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Thanks for the library, it's great addition to our system. However, I was wondering - what do you think of adding support for async handlers?
We have subscription handler where we need to call async methods. Could wrap of course in some GetAwaiter magic, but was wondering about "native" support from the hub side.
Any pointers whether this could be complex to add? Probably can contrib if you give some heads up ideas.
Thanks!
The text was updated successfully, but these errors were encountered:
I had intentionally not included support for asynchronous handlers as Tasks. This is by design as hub's only responsibility is to raise the events as they come in (fire and forget) it should not await for subscribers to finish processing them.
I would suggest (depending on your use-case) to consume your events by adding them to a pub/sub queue (think System.Threading.Channels or BlockingCollection<T>) which fits naturally with the producer/consumer pattern.
Alternatively, it is acceptable to use async void for cases where you need to await inside your handlers (see THIS, THIS and THIS).
Hi,
Thanks for the library, it's great addition to our system. However, I was wondering - what do you think of adding support for async handlers?
We have subscription handler where we need to call async methods. Could wrap of course in some
GetAwaiter
magic, but was wondering about "native" support from the hub side.Any pointers whether this could be complex to add? Probably can contrib if you give some heads up ideas.
Thanks!
The text was updated successfully, but these errors were encountered: