             _ = device.cancelConnection().subscribe()
         }
         connectedPeripherals.removeAll()
+        pendingReads.removeAll()
     }
 
     deinit {


        let disposable = observable.subscribe(
            onNext: { [weak self] characteristic in
                self?.dispatchEvent(BleEvent.readEvent, value: [NSNull(), characteristic.asJSObject, transactionId])
            }, onError: { [weak self] error in
                self?.dispatchEvent(BleEvent.readEvent, value: [error.bleError.toJS, NSNull(), transactionId])
            }, onCompleted: {


    // Disposable map for every transaction.
    private let transactions = DisposableMap<String>()

    // Map of pending read operations.
    private var pendingReads = Dictionary<Double, Int>()

    // MARK: Lifecycle -------------------------------------------------------------------------------------------------

