websockets-0.8.2.1: A sensible and clean way to write WebSocket-capable servers in Haskell.

Safe HaskellNone

Network.WebSockets.Connection

Synopsis

Documentation

data PendingConnection Source

A new client connected to the server. We haven't accepted the connection yet, though.

Constructors

PendingConnection 

Fields

pendingOptions :: ConnectionOptions

Options, passed as-is to the Connection

pendingRequest :: RequestHead

Useful for e.g. inspecting the request path.

pendingOnAccept :: Connection -> IO ()

One-shot callback fired when a connection is accepted, i.e., *after* the accepting response is sent to the client.

pendingIn :: InputStream ByteString

Input stream

pendingOut :: OutputStream Builder

Output stream

receiveDataMessage :: Connection -> IO DataMessageSource

Receive an application message. Automatically respond to control messages.

receiveData :: WebSocketsData a => Connection -> IO aSource

Receive a message, converting it to whatever format is needed.

sendTextData :: WebSocketsData a => Connection -> a -> IO ()Source

Send a message as text

sendBinaryData :: WebSocketsData a => Connection -> a -> IO ()Source

Send a message as binary data

sendClose :: WebSocketsData a => Connection -> a -> IO ()Source

Send a friendly close message

sendPing :: WebSocketsData a => Connection -> a -> IO ()Source

Send a ping