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
{{ message }}
This repository was archived by the owner on Dec 18, 2018. It is now read-only.
The fact that subscriptions cannot be removed once added
Passing state to callback to avoid closers
The big changes are:
Events registration method calls instead of .NET events. This allows taking a state parameter to avoid closure allocations.
Event registration methods also return IDisposable to allow removing the underlying subscription.
The other big benefit of methods for event registration are the ability to add overloads. We can support non async overloads of event handlers which means callers aren't forced to return Task.CompletedTask.
The Connected event has been removed since StartAsync represents the same thing. If we need to support a model where outside actors need to subscribe to the event we can consider making Start return the same task instead of throwing.
The closed event is removed in favor of a cancellation token. It means you can poll for closure as well as use a callback. It also allows passing the connection lifetime to other APIs. It also means you can get notified that the connection has closed after it has closed. One downside of this is that you can't run async logic that we wait on.
PS: This doesn't take into account the possibility that we might want to change IConnection to be pipe based in the near future (this means Send and Receive would go away).
I'm proposing a new client side API design to solve a bunch of issues:
The big changes are:
PS: This doesn't take into account the possibility that we might want to change
IConnectionto be pipe based in the near future (this means Send and Receive would go away)./cc @moozzyk