     - 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.

    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
    

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

public let DDP_WEBSOCKET_CLOSE = "DDP_WEBSOCKET_CLOSE"
public let DDP_WEBSOCKET_ERROR = "DDP_WEBSOCKET_ERROR"
public let DDP_DISCONNECTED = "DDP_DISCONNECTED"
public let DDP_FAILED = "DDP_FAILED"

public struct DDPEvents {
    
    /**
