Question

I'm not sure what is the best way to unsubscribe from a channel when using Retlang.

When you subscribe by calling ISubscriber<T>::Subscribe(...) you are returned an IUnsubscriber. This interface has no methods.

Going up a level, IChannel<T> also does not have any methods.

The only thing I can think of is casting an ISubscriber<T> to the concrete Channel<T> and calling its Unsubscribe() method or adding an Unsubscribe() method to ISubscriber<T>.

I'm just curious if anyone knows what they had in mind before I modify the code.

Was it helpful?

Solution

The IUnsubscriber interface implements IDisposable. Just call Dispose() on the IUnsubscriber handle you receive, and it should unsubscribe itself.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top