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

Safe HaskellNone
LanguageHaskell2010

Web.Scotty.Comet

Synopsis

Documentation

connect #

Arguments

:: 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 #

kCometPlugin provides the location of the Kansas Comet jQuery plugin.

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

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 #

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

Instances
Eq Document # 
Instance details

Defined in Web.Scotty.Comet

data Options #

Constructors

Options 

Fields

  • 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

Instances
Eq Options # 
Instance details

Defined in Web.Scotty.Comet

Methods

(==) :: Options -> Options -> Bool #

(/=) :: Options -> Options -> Bool #

Ord Options # 
Instance details

Defined in Web.Scotty.Comet

Show Options # 
Instance details

Defined in Web.Scotty.Comet

Default Options # 
Instance details

Defined in Web.Scotty.Comet

Methods

def :: Options #

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

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

eventQueue :: Document -> TChan Value #

Events being sent

debugDocument :: IO Document #

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

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

Fake a specific reply on a virtual Document port.