network-websocket-0.1: WebSocket library

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

Documentation

data Config Source

Server configuration structure

Constructors

Config 

Fields

configPort :: Int

The port to bind to

configOrigin :: String

The origin URL used in the handshake

configLocation :: String

The 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 WS Source

Connection state structure

Constructors

WS 

Fields

config :: Config

The server's configuration

handle :: Handle

The handle of the connected socket

send :: WS -> String -> IO ()Source