         - parameter callback:     Callback to be called upon success
     */
     private func modifySubscription(interest: String, change: SubscriptionChange, successCallback: @escaping (Any?) -> Void) {
-        guard pusherAppKey != nil, clientId != nil else {
-            self.socketConnection?.delegate?.debugLog?(message: "pusherAppKey \(pusherAppKey) or clientId \(clientId) not set - waiting for both to be set")
+        guard pusherAppKey != nil && clientId != nil else {
+            self.delegate?.debugLog?(message: "pusherAppKey \(pusherAppKey) or clientId \(clientId) not set - waiting for both to be set")
             self.requestQueue.pauseAndResetCurrentTask()
             return
         }
 
-        self.socketConnection?.delegate?.debugLog?(message: "Attempt number: \(self.failedRequestAttempts + 1) of \(maxFailedRequestAttempts)")
+        self.delegate?.debugLog?(message: "Attempt number: \(self.failedRequestAttempts + 1) of \(maxFailedRequestAttempts)")
 
         let url = "\(CLIENT_API_V1_ENDPOINT)/clients/\(clientId!)/interests/\(interest)"
         var request = URLRequest(url: URL(string: url)!)

                            if let clientIdJson = json["id"] {
                                if let clientId = clientIdJson as? String {
                                    self.clientId = clientId
                                    self.pusher?.delegate?.didRegisterForPushNotifications?(clientId: clientId)
                                    self.socketConnection?.delegate?.debugLog?(message: "Successfully registered for push notifications and got clientId: \(clientId)")
                                    self.requestQueue.run()
                                } else {
                                    self.socketConnection?.delegate?.debugLog?(message: "Value at \"id\" key in JSON response was not a string: \(json)")
                                }
                            } else {
                                self.socketConnection?.delegate?.debugLog?(message: "No \"id\" key in JSON response: \(json)")
                            }
                        } else {
                            self.socketConnection?.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.socketConnection?.delegate?.debugLog?(message: "Bad HTTP response: \(response!) with body: \(responseBody)")
                }
            }
        })

    private var failedRequestAttempts: Int = 0
    private let maxFailedRequestAttempts: Int = 6

    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
    */
    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
    */
    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
