Safe Haskell | Safe-Inferred |
---|---|
Language | GHC2021 |
This module contains the DisplayClient
logic.
Synopsis
- data DisplayClient = DisplayClient {}
- sendHtml :: DisplayClient -> HtmlT STM () -> STM ()
- sendsHtml :: DisplayClients -> HtmlT STM () -> ProcessIO ()
- sendsHtmlButSelf :: DisplayClient -> DisplayClients -> HtmlT STM () -> ProcessIO ()
- clientsDraw :: DisplayClients -> (DisplayClient -> ProcessIO (HtmlT STM ())) -> ProcessIO ()
- sendBinary :: DisplayClient -> LByteString -> STM ()
- sendsBinary :: DisplayClients -> LByteString -> ProcessIO ()
- sendsBinaryButSelf :: DisplayClient -> DisplayClients -> LByteString -> ProcessIO ()
- recvData :: MonadIO m => DisplayClient -> m DataMessage
- recvBinary :: MonadIO m => DisplayClient -> m ByteString
- pingThread :: DisplayClient -> ProcessIO Void
- sendThread :: DisplayClient -> ProcessIO Void
- data DisplayClients
- newDisplayClients :: STM DisplayClients
- getClients :: DisplayClients -> STM [DisplayClient]
- addClient :: DisplayClients -> DisplayClient -> STM ()
- delClient :: DisplayClients -> DisplayClient -> STM ()
- newClient :: Connection -> Endpoint -> Process -> Session -> STM DisplayClient
- newtype Endpoint = Endpoint Text
Display client
data DisplayClient #
A network client. Note that the sendThread
must be running for the send*
function to work.
Instances
ToJSON DisplayClient # | |
Defined in Butler.Display.Client toJSON :: DisplayClient -> Value # toEncoding :: DisplayClient -> Encoding # toJSONList :: [DisplayClient] -> Value # toEncodingList :: [DisplayClient] -> Encoding # |
Html output
sendsHtmlButSelf :: DisplayClient -> DisplayClients -> HtmlT STM () -> ProcessIO () #
Send Html to all clients except the provided one (self).
clientsDraw :: DisplayClients -> (DisplayClient -> ProcessIO (HtmlT STM ())) -> ProcessIO () #
Send html using a draw action.
Binary output
sendBinary :: DisplayClient -> LByteString -> STM () #
Send binary to a client.
sendsBinary :: DisplayClients -> LByteString -> ProcessIO () #
Send binary to all clients.
sendsBinaryButSelf :: DisplayClient -> DisplayClients -> LByteString -> ProcessIO () #
Send binary to all clients except the provided one (self).
Inputs
recvData :: MonadIO m => DisplayClient -> m DataMessage #
Low-level helper to read a DataMessage
.
recvBinary :: MonadIO m => DisplayClient -> m ByteString #
Low-level helper to read a binary buffer.
Management thread
pingThread :: DisplayClient -> ProcessIO Void #
An action to keep a client alive.
sendThread :: DisplayClient -> ProcessIO Void #
An action to send data message.
Collection of clients
data DisplayClients #
A collection of clients.
getClients :: DisplayClients -> STM [DisplayClient] #
addClient :: DisplayClients -> DisplayClient -> STM () #
delClient :: DisplayClients -> DisplayClient -> STM () #
Internal
newClient :: Connection -> Endpoint -> Process -> Session -> STM DisplayClient #