     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

    Notifications are published to "interests".
    Clients (such as this app instance) subscribe to those interests.

    A per-app singleton of NativePusher is available via an instance of Pusher.
    Use the Pusher.nativePusher() method to get access to it.
*/
@objc open class NativePusher: NSObject {
    static let sharedInstance = NativePusher()

    private static let PLATFORM_TYPE = "apns"
    private let CLIENT_API_V1_ENDPOINT = "https://nativepushclient-cluster1.pusher.com/client_api/v1"
    private let LIBRARY_NAME_AND_VERSION = "pusher-websocket-swift " + VERSION

                    self.failedRequestAttempts += 1

                    if error != nil {
                        self.delegate?.debugLog?(message: "Error when trying to modify subscription to interest: \(error?.localizedDescription)")
                    } else if data != nil && response != nil {
                        let responseBody = String(data: data!, encoding: .utf8)
                        self.delegate?.debugLog?(message: "Bad response from server: \(response!) with body: \(responseBody)")
                    } else {
                        self.delegate?.debugLog?(message: "Bad response from server when trying to modify subscription to interest: \(interest)")
                    }

                    if self.failedRequestAttempts >= self.maxFailedRequestAttempts {
                        self.delegate?.debugLog?(message: "Max number of failed native service requests reached")

                        self.requestQueue.paused = true
                    } else {
                        self.delegate?.debugLog?(message: "Retrying subscription modification request for interest: \(interest)")
                        self.requestQueue.retry(Double(self.failedRequestAttempts * self.failedRequestAttempts))
                    }

