kansas-comet-0.4: A JavaScript push mechanism based on the comet idiom

Safe HaskellNone




connect Source


:: Options

URL path prefix for this page

-> (Document -> IO ())

called for access of the page

-> IO (ScottyM ()) 

connect "/foobar" (...) gives a scotty session that:

 POST http://.../foobar/                       <- bootstrap the interaction
 GET  http://.../foobar/act/<id#>/<act#>       <- get a specific action
 POST http://.../foobar/reply/<id#>/<reply#>   <- send a reply as a JSON object

kCometPlugin :: IO String Source

kCometPlugin provides the location of the Kansas Comet jQuery plugin.

send :: Document -> Text -> IO () Source

send sends a javascript fragement to a document. The Text argument will be evaluated before sending (in case there is an error, or some costly evaluation needs done first). send suspends the thread if the last javascript has not been *dispatched* the the browser.

data Document Source

Document is the Handle into a specific interaction with a web page.


data Options Source




prefix :: String

what is the prefix at at start of the URL (for example "ajax")

verbose :: Int

0 == none (default), 1 == inits, 2 == cmds done, 3 == complete log

getReply :: Document -> Int -> IO Value Source

wait for a virtual-to-this-document's port numbers' reply.

eventQueue :: Document -> TChan Value Source

Events being sent

debugDocument :: IO Document Source

Generate a Document that prints what it would send to the server.

debugReplyDocument :: Document -> Int -> Value -> IO () Source

Fake a specific reply on a virtual Document port.