     - parameter error:      An ErrorType object describing the error
     */
     
-    internal var onWebsocketError:    (_ error:Error) -> () = {error in log.error("websocket error \(error)")}
+    internal var onWebsocketError:    (_ error:Error) -> () = {error in
+        log.error("websocket error \(error)")
+        NotificationCenter.default.post(name: Notification.Name(rawValue: DDP_WEBSOCKET_ERROR), object: nil)
+    }
     
     /**
     onConnected executes when the client makes a DDP connection

    onDisconnected executes when the client is disconnected
    */
    
    public var onDisconnected:      () -> () = {log.debug("disconnected")}
    
    /**
    onFailed executes when an attempt to make a DDP connection fails
    */
    
    public var onFailed:            () -> () = {log.error("failed")}
    
    // Data messages
    

    - parameter clean:      A boolean value indicating if the websocket connection was closed cleanly
    */
    
    internal var onWebsocketClose:    ((_ code:Int, _ reason:String, _ clean:Bool) -> ())? = { code, reason, clean in
        NotificationCenter.default.post(name: Notification.Name(rawValue: DDP_WEBSOCKET_CLOSE), object: nil)
    }
    
    /**
    onWebsocketError executes when the websocket connection returns an error.
