     
     private func setUpReachabilityObserver() {
         
-        let reachabilityObserver = defaultCenter?.addObserver(
+        let reachabilityObserver = appStateCenter.addObserver(
             forName: ReachabilityChangedNotification,
             object: self,
             queue: nil,

    private var observers = [NSObjectProtocol?]()
    
    init(
        defaultCenter: VKNotificationCenter?,
        workspaceCenter: VKNotificationCenter?,
        reachability: VKReachability
        ) {
        self.defaultCenter = defaultCenter
        self.workspaceCenter = workspaceCenter
        self.reachability = reachability
    }
    
    public func setUp(
        onConnect: @escaping () -> (),
        onDisconnect: @escaping () -> ()
        ) {
        
        self.onConnect = onConnect
        self.onDisconnect = onDisconnect
        
        #if os(OSX)
            setUpMacOsObservers()
        #elseif os(iOS)
            setUpIosObservers()
        #endif
        
        setUpReachabilityObserver()
    }
    
    @available(macOS 10.0, *)
    private func setUpMacOsObservers() {
        let becomeActiveObserver = workspaceCenter?.addObserver(
            forName: NSWorkspace.screensDidWakeNotification,
            object: self,
            queue: nil,
            using: { [weak self] notification in

    import Cocoa
#endif

protocol ConnectionObserver {
    func setUp(onConnect: @escaping () -> (), onDisconnect: @escaping () -> ())
}

internal final class ConnectionObserverImpl: ConnectionObserver {
    
    private let appStateCenter: VKNotificationCenter
    private let reachabilityCenter: VKNotificationCenter
    private let reachability: VKReachability
    
    private let activeNotificationName: Notification.Name
    private let inactiveNotificationName: Notification.Name
    private let reachabilityNotificationName: Notification.Name
    
    private var appIsActive = true
    private var onConnect: (() -> ())?
