- shakeHands :: Handle -> IO (Either String Request)
- getRequest :: Handle -> IO (Either String Request)
- putResponse :: Handle -> Request -> IO ()
- getFrame :: Handle -> IO ByteString
- putFrame :: Handle -> ByteString -> IO ()
- reqHost :: Request -> String
- reqPath :: Request -> String
- reqOrigin :: Request -> String
- reqLocation :: Request -> String
- data Request
Accept and perform a handshake, no matter the request contents.
As long as the request is well-formed, the client will receive a response saying, essentially, "proceed". Use this function if you don't care who you're connected to, as long as that someone speaks the WebSocket protocol.
The function returns either a String in case of error, or a
Request on success. The
Request is returned purely for logging purposes, since the handshake has already been executed. Use this function immediately after establishing the WebSocket connection.
Reads the client's opening handshake and returns either a
Request based on its contents, or a String in case of an error.
Sends an accepting response based on the given
Request, thus accepting and ending the handshake.
Receive a strict ByteString. Call this function only after having performed the handshake. This function will block until an entire frame is read. If the writing end of the handle is closed, the function returns an empty ByteString.
Send a strict ByteString. Call this function only after having performed the handshake.
Returns the requested location. Equal to
(\r -> "ws://" ++ reqHost r ++ reqPath r).