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
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.
The text was updated successfully, but these errors were encountered:
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) andPTPusherChannel
(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.The text was updated successfully, but these errors were encountered: