mirror of
https://github.com/firebase/firebase-ios-sdk
synced 2026-11-10 22:45:59 +05:45
Log direct-channel state changes to console (#287)
This commit is contained in:
1 parent
9447e72cab
commit
66f3aeda16
1 file changed
+11
@@ -51,6 +51,8 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
|
||||
FirebaseApp.configure()
|
||||
Messaging.messaging().delegate = self
|
||||
Messaging.messaging().shouldEstablishDirectChannel = true
|
||||
// Just for logging to the console when we establish/tear down our socket connection.
|
||||
listenForDirectChannelStateChanges();
|
||||
|
||||
NotificationsController.configure()
|
||||
|
||||
@@ -126,3 +128,12 @@ extension AppDelegate: MessagingDelegate {
|
||||
}
|
||||
}
|
||||
|
||||
extension AppDelegate {
|
||||
func listenForDirectChannelStateChanges() {
|
||||
NotificationCenter.default.addObserver(self, selector: #selector(onMessagingDirectChannelStateChanged(_:)), name: .MessagingConnectionStateChanged, object: nil)
|
||||
}
|
||||
|
||||
func onMessagingDirectChannelStateChanged(_ notification: Notification) {
|
||||
print("FCM Direct Channel Established: \(Messaging.messaging().isDirectChannelEstablished)")
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user