-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/


-- | A JavaScript push mechanism based on the comet idiom
--   
--   A transport-level remote JavaScript RESTful push mechanism.
@package kansas-comet
@version 0.4

module Web.Scotty.Comet

-- | connect "/foobar" (...) gives a scotty session that:
--   
--   <pre>
--   POST http://.../foobar/                       &lt;- bootstrap the interaction
--   GET  http://.../foobar/act/&lt;id#&gt;/&lt;act#&gt;       &lt;- get a specific action
--   POST http://.../foobar/reply/&lt;id#&gt;/&lt;reply#&gt;   &lt;- send a reply as a JSON object
--   </pre>
connect :: Options -> (Document -> IO ()) -> IO (ScottyM ())

-- | <a>kCometPlugin</a> provides the location of the Kansas Comet jQuery
--   plugin.
kCometPlugin :: IO String

-- | <a>send</a> 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). <a>send</a> suspends the
--   thread if the last javascript has not been *dispatched* the the
--   browser.
send :: Document -> Text -> IO ()

-- | <a>Document</a> is the Handle into a specific interaction with a web
--   page.
data Document
data Options
Options :: String -> Int -> Options

-- | what is the prefix at at start of the URL (for example "ajax")
[prefix] :: Options -> String

-- | 0 == none (default), 1 == inits, 2 == cmds done, 3 == complete log
[verbose] :: Options -> Int

-- | wait for a virtual-to-this-document's port numbers' reply.
getReply :: Document -> Int -> IO Value

-- | Events being sent
eventQueue :: Document -> TChan Value

-- | Generate a <tt>Document</tt> that prints what it would send to the
--   server.
debugDocument :: IO Document

-- | Fake a specific reply on a virtual <tt>Document</tt> port.
debugReplyDocument :: Document -> Int -> Value -> IO ()
defaultOptions :: Options
instance GHC.Show.Show Web.Scotty.Comet.Options
instance GHC.Classes.Ord Web.Scotty.Comet.Options
instance GHC.Classes.Eq Web.Scotty.Comet.Options
instance GHC.Classes.Eq Web.Scotty.Comet.Document
instance Data.Default.Class.Default Web.Scotty.Comet.Options
