-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Socket.IO server -- -- Socket.IO for Haskell folks. -- -- -- --
--   {-# LANGUAGE OverloadedStrings #-}
--   
--   import Web.SocketIO
--   
--   -- listens to port 4000
--   main = server 4000 $ do
--   
--       -- ping pong
--       on "ping" $ emit "pong" []
--   
--       -- msg :: CallbackM [Text]
--       on "echo" $ msg >>= emit "pong"
--   
--       -- do some IO
--       on "Kim Jong-Un" $ liftIO launchMissile
--   
@package socketio @version 0.1.3 -- | Socket.IO for Haskell folks. module Web.SocketIO -- | Run a socket.io application, build on top of Warp. server :: Port -> HandlerM () -> IO () -- | Run a socket.io application with configurations applied. serverConfig :: Port -> Configuration -> HandlerM () -> IO () -- | Default configuration. -- --
--   defaultConfig = Configuration
--      {   transports = [XHRPolling]
--      ,   logLevel = 2               
--      ,   logTo = stderr        
--      ,   header = [("Access-Control-Allow-Credentials", "true")]      
--      ,   heartbeats = True
--      ,   closeTimeout = 60
--      ,   heartbeatTimeout = 60
--      ,   heartbeatInterval = 25
--      ,   pollingDuration = 20
--      }
--   
-- -- You can override it like so: -- --
--   myConfig = defaultConfig { logLevel = 0 }
--   
-- -- Unless specified, the header will be modified to enable cross-origin -- resource sharing (CORS) like this. -- --
--   header = 
--      [   ("Access-Control-Allow-Origin", <origin-of-the-reqeust>)]      
--      ,   ("Access-Control-Allow-Credentials", "true")
--      ]      
--   
defaultConfig :: Configuration -- | Defines behaviors of a Socket.IO server data Configuration Configuration :: [Transport] -> Int -> Handle -> Bool -> ResponseHeaders -> Int -> Int -> Int -> Int -> Configuration transports :: Configuration -> [Transport] -- | there are 4 levels, from 0 to 3: Error, Warn, Info, Debug logLevel :: Configuration -> Int logTo :: Configuration -> Handle heartbeats :: Configuration -> Bool header :: Configuration -> ResponseHeaders closeTimeout :: Configuration -> Int heartbeatTimeout :: Configuration -> Int heartbeatInterval :: Configuration -> Int pollingDuration :: Configuration -> Int -- | Port number for a standalone Socket.IO server. type Port = Int -- | Now only xhr-polling is supported. socket.io-spec#transport-id data Transport XHRPolling :: Transport -- | Receives events. class Subscriber m on :: Subscriber m => EventName -> CallbackM () -> m () -- | Sends events class Publisher m emit :: Publisher m => EventName -> [Value] -> m () broadcast :: Publisher m => EventName -> [Value] -> m () -- | This function is deprecated; use msg instead -- | Deprecated: use msg instead reply :: CallbackM [Value] -- | Extracts payload carried by the event -- --
--   on "echo" $ do
--       payload <- msg
--       liftIO $ print payload
--       emit echo payload 
--   
msg :: CallbackM [Value] -- | Lazy ByteString version of msg, convenient for Aeson decoding. msg' :: CallbackM [ByteString] -- | Name of the event getEventName :: CallbackM EventName -- | Class for SessionID getter. class HasSessionID m getSessionID :: HasSessionID m => m SessionID -- | Name of an Event type EventName = Text -- | Session ID type SessionID = ByteString -- | Capable of both sending and receiving events. -- -- Use liftIO if you wanna do some IO here. data HandlerM a -- | Capable of only sending events. -- -- Use liftIO if you wanna do some IO here. data CallbackM a