Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support [channel unsubscribe] #43

Closed
lukeredpath opened this issue Apr 24, 2012 · 0 comments
Closed

Support [channel unsubscribe] #43

lukeredpath opened this issue Apr 24, 2012 · 0 comments

Comments

@lukeredpath
Copy link
Contributor

Currently, to unsubscribe from a channel requires passing a channel object into [PTPusher unsubscribeFromChannel:].

This API requires that a channel should never be nil (it will currently crash). I think this is correct behaviour and should be enforced with an assertion, but it does make things slightly more awkward for the library user as they must do an explicit nil check before calling unsubscribe.

An alternative or complementary API would be to support calling [channel unsubscribe] directly. This would avoid the need for a nil check as [nil unsubscribe] would be a no-op, as per Objective-C calling conventions.

I would greatly prefer to have this API rather than having [PTPusher unsubscribeFromChannel:] perform a nil check and ignore it silently.

The main hurdle in supporting this API is that unsubscribing from a channel currently has responsibilities in both PTPusher (removing the channel from the subscription list) and PTPusherChannel (sending the unsubscribe message to the server). Some refactoring is needed here to consolidate this logic such that an unsubscribe could be triggered from either side of the API.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant