- data Handler
- data ConnectedHandler
- mkHandler :: String -> String -> Maybe String -> Handler
- withConnectedHandler :: Handler -> (ConnectedHandler -> IO a) -> IO a
- receiveRequest :: ConnectedHandler -> IO (Connection, Request)
- sendReply :: ConnectedHandler -> UUID -> [ClientID] -> Builder -> IO ()
- simpleReply :: ConnectedHandler -> Connection -> Builder -> IO ()
- buildResponse :: Status -> ResponseHeaders -> ByteString -> Builder
- type ClientID = Int64
- data Connection = Connection {}
- data Request = Request {}
- type UUID = ByteString
Documentation
data ConnectedHandler Source
mkHandler :: String -> String -> Maybe String -> HandlerSource
Create a new handler. mkHandler pullFromAddress publishToAddress id
creates a handler which pulls requests from fromAddress
and publishes
replies to publishAddress
.
withConnectedHandler :: Handler -> (ConnectedHandler -> IO a) -> IO aSource
Run an IO action with a connected handler.
receiveRequest :: ConnectedHandler -> IO (Connection, Request)Source
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.
sendReply :: ConnectedHandler -> UUID -> [ClientID] -> Builder -> IO ()Source
Send a reply to the Mongrel2 server.
simpleReply :: ConnectedHandler -> Connection -> Builder -> IO ()Source
Simplied form of sendReply
function. This variant sends a reply
to the requesting client with no option of sending replies to other
clients.
buildResponse :: Status -> ResponseHeaders -> ByteString -> BuilderSource
Build a HTTP response.
Client identifier from Mongrel2. This identifies the currently connected client uniquely.
data Connection Source
Connection information.
Connection | |
|
Request information.
Request | |
|
type UUID = ByteStringSource
UUID for communicating with Mongrel2.