     - parameter clean:      A boolean value indicating if the websocket connection was closed cleanly
     */
     
-    internal var onWebsocketClose:    ((_ code:Int, _ reason:String, _ clean:Bool) -> ())?
+    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.

closures to modify the clients behavior in response to the trigger event.
*/

public struct DDPEvents {
    
    /**

    - parameter error:      An ErrorType object describing the 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
