 
 extension WebSocket {
     /// The events of the WebSocket using a delegate.
+    @objc
     public var delegate : WebSocketDelegate? {
         get { return ws.eventDelegate }
         set { ws.eventDelegate = newValue }

        free(buffer)
    }
    /*func deflate(_ bufin : UnsafePointer<UInt8>, length : Int, final : Bool) -> (p : UnsafeMutablePointer<UInt8>, n : Int, err : NSError?){
        return (nil, 0, nil)
    }*/
}

/// WebSocketDelegate is an Objective-C alternative to WebSocketEvents and is used to delegate the events for the WebSocket connection.

private enum TCPConnSecurity {
    case none
    case negoticatedSSL

    var level: String {
        switch self {
        case .none: return StreamSocketSecurityLevel.none.rawValue
        case .negoticatedSSL: return StreamSocketSecurityLevel.negotiatedSSL.rawValue
        }
    }
}

// Manager class is used to minimize the number of dispatches and cycle through network events
