     private var failedRequestAttempts: Int = 0
     private let maxFailedRequestAttempts: Int = 6
 
-    internal var socketConnection: PusherConnection? = nil
-    internal var pusher: Pusher? = nil
-
-    private var requestQueue = TaskQueue()
+    internal var delegate: PusherDelegate? = nil
+
+    internal var requestQueue = TaskQueue()
 
     /**
         Identifies a Pusher app, which should have push notifications enabled
-        and a certificate added for the push notifications to work.
+        and a certificate added for the push notifications to work
     */
     private var pusherAppKey: String? = nil
 
     /**
         The id issued to this app instance by Pusher, which is received upon
         registrations. It's used to identify a client when subscribe /
-        unsubscribe requests are made.
-    */
-    private var clientId: String? = nil
-
-    /**
-        Normal clients should access the shared instance via Pusher.nativePusher().
-    */
-    private override init() {}
+        unsubscribe requests are made
+    */
+    internal var clientId: String? = nil
+
+    /**
+        Normal clients should access the instance via Pusher.nativePusher()
+    */
+    internal override init() {}
 
     /**
         Sets the pusherAppKey property and then attempts to flush


                switch change {
                case .subscribe:
                    self.pusher?.delegate?.didSubscribeToInterest?(named: interest)
                case .unsubscribe:
                    self.pusher?.delegate?.didUnsubscribeFromInterest?(named: interest)
                }

                self.socketConnection?.delegate?.debugLog?(message: "Success making \(change.stringValue) to \(interest)")

                self.failedRequestAttempts = 0
                successCallback(nil)

                            if let clientIdJson = json["id"] {
                                if let clientId = clientIdJson as? String {
                                    self.clientId = clientId
                                    self.delegate?.registeredForPushNotifications?(clientId: clientId)
                                    self.delegate?.debugLog?(message: "Successfully registered for push notifications and got clientId: \(clientId)")
                                    self.requestQueue.run()
                                } else {
                                    self.delegate?.debugLog?(message: "Value at \"id\" key in JSON response was not a string: \(json)")
                                }
                            } else {
                                self.delegate?.debugLog?(message: "No \"id\" key in JSON response: \(json)")
                            }
                        } else {
                            self.delegate?.debugLog?(message: "Could not parse body as JSON object: \(data)")
                        }
            } else {
                if data != nil && response != nil {
                    let responseBody = String(data: data!, encoding: .utf8)
                    self.delegate?.debugLog?(message: "Bad HTTP response: \(response!) with body: \(responseBody)")
                }
            }
        })
