-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/
-- | Mongrel2 Handler Library
--
-- Mongrel2 Handler Library. This handler library requires that the
-- Mongrel2 server is set up to use the tnetstring protocol.
@package mongrel2-handler
@version 0.3.0
module Mongrel2
data Handler
data ConnectedHandler
-- | Create a new handler. mkHandler pullFromAddress publishToAddress
-- id creates a handler which pulls requests from
-- fromAddress and publishes replies to publishAddress.
mkHandler :: String -> String -> Maybe String -> Handler
-- | Run an IO action with a connected handler.
withConnectedHandler :: Handler -> (ConnectedHandler -> IO a) -> IO a
-- | Receive a parsed request from the Mongrel2 server. Blocks until a
-- message is received. The Mongrel2 server will signal a client
-- disconnect by sending a Request with method JSON and a
-- request body containing a JSON object with a key type
-- containing the value disconnect. No response should be sent
-- for such a request.
receiveRequest :: ConnectedHandler -> IO (Connection, Request)
-- | Send a reply to the Mongrel2 server.
sendReply :: ConnectedHandler -> UUID -> [ClientID] -> Builder -> IO ()
-- | Connection information.
data Connection
Connection :: UUID -> ClientID -> Connection
-- | UUID of the connected Mongrel2 server.
connServerUUID :: Connection -> UUID
-- | ID of the connected client browser.
connClientID :: Connection -> ClientID
-- | Request information.
data Request
Request :: [Text] -> Query -> ByteString -> Either Ascii StdMethod -> Maybe HttpVersion -> RequestHeaders -> ByteString -> Request
-- | Request path
reqPath :: Request -> [Text]
-- | Query part of the request
reqQuery :: Request -> Query
-- | Raw request path including query part.
reqRawPath :: Request -> ByteString
-- | Request method (GET, POST, etc.)
reqMethod :: Request -> Either Ascii StdMethod
-- | HTTP version
reqVersion :: Request -> Maybe HttpVersion
-- | Request headers
reqHeaders :: Request -> RequestHeaders
-- | Request body.
reqBody :: Request -> ByteString
-- | UUID for communicating with Mongrel2.
type UUID = ByteString
-- | Client identifier from Mongrel2. This identifies the currently
-- connected client uniquely.
type ClientID = Int64