Safe Haskell | Safe-Inferred |
---|---|
Language | GHC2021 |
Websocket components built with Box
es.
Synopsis
- data SocketConfig = SocketConfig {}
- defaultSocketConfig :: SocketConfig
- connect :: SocketConfig -> Codensity IO Connection
- serve :: SocketConfig -> Codensity IO Connection
- pending :: PendingConnection -> Codensity IO Connection
- serverApp :: Box IO Text Text -> PendingConnection -> IO ()
- receiver :: WebSocketsData a => Committer IO a -> Connection -> IO ()
- receiver_ :: (WebSocketsData a, Show a) => Committer IO a -> Committer IO Text -> Connection -> IO ()
- sender :: WebSocketsData a => Emitter IO a -> Connection -> IO SocketStatus
- sender_ :: (WebSocketsData a, Show a) => Emitter IO a -> Committer IO Text -> Connection -> IO SocketStatus
- duplex :: WebSocketsData a => PostSend -> Box IO a a -> Connection -> IO ()
- duplex_ :: (WebSocketsData a, Show a) => PostSend -> Committer IO Text -> Box IO a a -> Connection -> IO ()
- clientBox :: WebSocketsData a => SocketConfig -> PostSend -> Box IO a a -> IO ()
- clientCoBox :: WebSocketsData a => SocketConfig -> PostSend -> CoBox IO a a
- serverBox :: WebSocketsData a => SocketConfig -> PostSend -> Box IO a a -> IO ()
- serverCoBox :: WebSocketsData a => SocketConfig -> PostSend -> CoBox IO a a
- responseServer :: WebSocketsData a => SocketConfig -> (a -> Maybe a) -> IO ()
Documentation
data SocketConfig Source #
Socket configuration
>>>
defaultSocketConfig
SocketConfig {host = "127.0.0.1", port = 9160, path = "/"}
Instances
defaultSocketConfig :: SocketConfig Source #
official default
connect :: SocketConfig -> Codensity IO Connection Source #
connect an action (ie a client)
serve :: SocketConfig -> Codensity IO Connection Source #
serve an action (ie a server)
pending :: PendingConnection -> Codensity IO Connection Source #
Given a PendingConnection
, provide a Connection
continuation.
serverApp :: Box IO Text Text -> PendingConnection -> IO () Source #
Attach a box to a PendingConnection
in wai-style.
receiver :: WebSocketsData a => Committer IO a -> Connection -> IO () Source #
Commit received messages, finalising on receiving a CloseRequest
receiver_ :: (WebSocketsData a, Show a) => Committer IO a -> Committer IO Text -> Connection -> IO () Source #
Commit received messages, finalising on receiving a CloseRequest
, with event logging.
sender :: WebSocketsData a => Emitter IO a -> Connection -> IO SocketStatus Source #
Send emitted messages, returning whether the socket remained open (the Emitter
ran out of emits) or closed (a CloseRequest
was received).
sender_ :: (WebSocketsData a, Show a) => Emitter IO a -> Committer IO Text -> Connection -> IO SocketStatus Source #
Send emitted messages, returning whether the socket remained open (the Emitter
ran out of emits) or closed (a CloseRequest
was received). With event logging.
duplex :: WebSocketsData a => PostSend -> Box IO a a -> Connection -> IO () Source #
A two-way connection. Closes if it receives a CloseRequest
exception, or if PostSend
is CloseAfter
.
duplex_ :: (WebSocketsData a, Show a) => PostSend -> Committer IO Text -> Box IO a a -> Connection -> IO () Source #
A two-way connection. Closes if it receives a CloseRequest
exception, or if PostSend
is CloseAfter
. With event logging.
clientBox :: WebSocketsData a => SocketConfig -> PostSend -> Box IO a a -> IO () Source #
A Box
action for a client.
clientCoBox :: WebSocketsData a => SocketConfig -> PostSend -> CoBox IO a a Source #
A client CoBox
.
serverBox :: WebSocketsData a => SocketConfig -> PostSend -> Box IO a a -> IO () Source #
A Box
action for a server.
serverCoBox :: WebSocketsData a => SocketConfig -> PostSend -> CoBox IO a a Source #
A server CoBox
.
responseServer :: WebSocketsData a => SocketConfig -> (a -> Maybe a) -> IO () Source #
A receiver that applies a response function to received messages.