network-websocket-0.3: WebSocket librarySource codeContentsIndex
Network.Websocket
Description
Library for creating Websocket servers. Some parts cribbed from Jeff Foster's blog post at http://www.fatvat.co.uk/2010/01/web-sockets-and-haskell.html
Synopsis
data Config = Config {
configPort :: Int
configOrigins :: ConfigRestriction
configDomains :: ConfigRestriction
configOnOpen :: WS -> IO ()
configOnMessage :: WS -> String -> IO ()
configOnClose :: WS -> IO ()
}
data ConfigRestriction
= Any
| Only [String]
data WS = WS {
wsConfig :: Config
wsHandle :: Handle
}
startServer :: Config -> IO ()
send :: WS -> String -> IO ()
Documentation
data Config Source
Server configuration structure
Constructors
Config
configPort :: IntThe port to bind to
configOrigins :: ConfigRestrictionThe origin URL used in the handshake
configDomains :: ConfigRestrictionThe location URL used in the handshake. This must match the Websocket url that the browsers connect to.
configOnOpen :: WS -> IO ()The onopen callback, called when a socket is opened
configOnMessage :: WS -> String -> IO ()The onmessage callback, called when a message is received
configOnClose :: WS -> IO ()The onclose callback, called when the connection is closed.
data ConfigRestriction Source
Constructors
Any
Only [String]
data WS Source
Connection state structure
Constructors
WS
wsConfig :: ConfigThe server's configuration
wsHandle :: HandleThe handle of the connected socket
startServer :: Config -> IO ()Source
send :: WS -> String -> IO ()Source
Produced by Haddock version 2.7.2