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
There is a `PusherConnectionDelegate` that you can use to get access to connection-related information. These are the functions that you can optionally implement when conforming to the `PusherConnectionDelegate` protocol:
303
+
There is a `PusherDelegate` that you can use to get notified of connection-related information. These are the functions that you can optionally implement when conforming to the `PusherDelegate` protocol:
304
304
305
305
```swift
306
-
@objc optional func connectionStateDidChange(from old: ConnectionState, to new: ConnectionState)
306
+
@objc optional func changedConnectionState(from old: ConnectionState, to new: ConnectionState)
The names of the functions largely give away what their purpose is but just for completeness:
313
313
314
-
-`connectionStateDidChange` - use this if you want to use connection state changes to perform different actions / UI updates
314
+
-`changedConnectionState` - use this if you want to use connection state changes to perform different actions / UI updates
315
+
-`subscribedToChannel` - use this if you want to be informed of when a channel has successfully been subscribed to, which is useful if you want to perform actions that are only relevant after a subscription has succeeded, e.g. logging out the members of a presence channel
316
+
-`failedToSubscribeToChannel` - use this if you want to be informed of a failed subscription attempt, which you could use, for exampple, to then attempt another subscription or make a call to a service you use to track errors
315
317
-`debugLog` - use this if you want to log Pusher-related events, e.g. the underlying websocket receiving a message
316
-
-`subscriptionDidSucceed` - use this if you want to be informed of when a channel has successfully been subscribed to, which is useful if you want to perform actions that are only relevant after a subscription has succeeded, e.g. logging out the members of a presence channel
317
-
-`subscriptionDidFail` - use this if you want to be informed of a failed subscription attempt, which you could use, for exampple, to then attempt another subscription or make a call to a service you use to track errors
You can also be notified of a successfull subscription by using the `subscriptionDidSucceed` delegate method on the `PusherConnection` object.
549
+
You can also be notified of a successfull subscription by using the `subscriptionDidSucceed` delegate method that is part of the `PusherDelegate` protocol.
550
550
551
-
Here is an example of using the connection delegate:
@@ -861,19 +861,19 @@ For a complete example of a working app, see the [Example/](https://github.com/p
861
861
862
862
### Pusher delegate
863
863
864
-
There is a `PusherDelegate` that you can use to get access to events that occur in relation to push notifications interactions. These are the functions that you can optionally implement when conforming to the `PusherDelegate` protocol:
864
+
You can also implement some of the `PusherDelegate` functions to get access to events that occur in relation to push notifications interactions. These are the functions that you can optionally implement when conforming to the `PusherDelegate` protocol:
Again, the names of the functions largely give away what their purpose is but just for completeness:
873
873
874
-
-`didRegisterForPushNotifications` - use this if you want to know when a client has successfully registered with the Pusher Push Notifications service, or if you want access to the `clientId` that is returned upon successful registration
875
-
-`didSubscribeToInterest` - use this if you want keep track of interests that are successfully subscribed to
876
-
-`didUnsubscribeFromInterest` - use this if you want keep track of interests that are successfully unsubscribed from
874
+
-`registeredForPushNotifications` - use this if you want to know when a client has successfully registered with the Pusher Push Notifications service, or if you want access to the `clientId` that is returned upon successful registration
875
+
-`subscribedToInterest` - use this if you want keep track of interests that are successfully subscribed to
876
+
-`unsubscribedFromInterest` - use this if you want keep track of interests that are successfully unsubscribed from
877
877
878
878
Setting up a delegate looks like this:
879
879
@@ -904,7 +904,7 @@ class ViewController: UIViewController, PusherDelegate {
904
904
}
905
905
```
906
906
907
-
The process is identical to that of setting up a `PusherConnectionDelegate`. At some point in the future the `PusherDelegate` and `PusherConnectionDelegate` will likely be merged into the `PusherDelegate` in order to provide one unified delegate that can be used to get notified of Pusher-related events.
907
+
The process is identical to that of setting up the `PusherDelegate` to receive notifications of connection-based events.
0 commit comments