     /// An event to be called when the WebSocket connection's readyState changes to .Open; this indicates that the connection is ready to send and receive data.
     public var open : ()->() = {}
     /// An event to be called when the WebSocket connection's readyState changes to .Closed.
-    public var close : (code : Int, reason : String, wasClean : Bool)->() = {(code, reason, wasClean) in}
+    public var close : (_ code : Int, _ reason : String, _ wasClean : Bool)->() = {(code, reason, wasClean) in}
     /// An event to be called when an error occurs.
-    public var error : (error : ErrorProtocol)->() = {(error) in}
+    public var error : (_ error : Error)->() = {(error) in}
     /// An event to be called when a message is received from the server.
-    public var message : (data : Any)->() = {(data) in}
+    public var message : (_ data : Any)->() = {(data) in}
     /// An event to be called when a pong is received from the server.
-    public var pong : (data : Any)->() = {(data) in}
+    public var pong : (_ data : Any)->() = {(data) in}
     /// An event to be called when the WebSocket process has ended; this event is guarenteed to be called once and can be used as an alternative to the "close" or "error" events.
-    public var end : (code : Int, reason : String, wasClean : Bool, error : ErrorProtocol?)->() = {(code, reason, wasClean, error) in}
+    public var end : (_ code : Int, _ reason : String, _ wasClean : Bool, _ error : Error?)->() = {(code, reason, wasClean, error) in}
 }
 
 /// The WebSocketBinaryType enum is used by the binaryType property and indicates the type of binary data being transmitted by the WebSocket connection.


    func readResponse() throws {
        let end : [UInt8] = [ 0x0D, 0x0A, 0x0D, 0x0A ]
        let ptr = UnsafeMutablePointer<UInt8>(memmem(inputBytes!+inputBytesStart, inputBytesLength, end, 4))
        if ptr == nil {
            throw WebSocketError.needMoreInput
        }
        let buffer = inputBytes!+inputBytesStart
        let bufferCount = ptr!-(inputBytes!+inputBytesStart)
        let string = NSString(bytesNoCopy: buffer, length: bufferCount, encoding: String.Encoding.utf8.rawValue, freeWhenDone: false) as? String
        if string == nil {
            throw WebSocketError.invalidHeader
        }

            }
            procd = 0
            count = 0
            text.append(String.init(describing: UnicodeScalar(codepoint)))
        }
        return
    }
