-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Box websockets -- -- Websockets built with the box library. @package box-socket @version 0.1.2 -- | Websocket components built with Boxes. module Box.Socket -- | Socket configuration -- --
-- >>> defaultSocketConfig
-- SocketConfig {host = "127.0.0.1", port = 9160, path = "/"}
--
data SocketConfig
SocketConfig :: Text -> Int -> Text -> SocketConfig
[host] :: SocketConfig -> Text
[port] :: SocketConfig -> Int
[path] :: SocketConfig -> Text
-- | official default
defaultSocketConfig :: SocketConfig
-- | Run a client app.
runClient :: MonadIO m => SocketConfig -> ClientApp () -> m ()
-- | Run a server app.
runServer :: MonadIO m => SocketConfig -> ServerApp -> m ()
-- | Connection continuation.
connect :: (MonadIO m, MonadConc m) => PendingConnection -> Cont m Connection
-- | A simple client app for a box with Left debug messages.
clientApp :: (MonadIO m, MonadConc m) => Box m (Either Text Text) Text -> Connection -> m ()
-- | Canned response function.
responderApp :: (Text -> Either Text Text) -> PendingConnection -> IO ()
-- | Standard server app for a box.
serverApp :: (MonadConc m, MonadIO m) => Box m Text Text -> PendingConnection -> m ()
-- | default websocket receiver with messages Lefts are info/debug
receiver' :: MonadIO m => Committer m (Either Text Text) -> Connection -> m Bool
-- | Receiver that only commits.
receiver :: MonadIO m => Committer m Text -> Connection -> m ()
-- | Sender that only emits.
sender :: (MonadIO m, WebSocketsData a, Show a) => Box m Text a -> Connection -> m ()
-- | A receiver that responds based on received Text. lefts are quit
-- signals. Rights are response text.
responder :: MonadIO m => (Text -> Either Text Text) -> Committer m Text -> Connection -> m ()
instance GHC.Generics.Generic Box.Socket.SocketConfig
instance GHC.Classes.Eq Box.Socket.SocketConfig
instance GHC.Show.Show Box.Socket.SocketConfig
-- | TCP Boxes.
module Box.TCP
-- | TCP configuration
--
--
-- >>> defaultTCPConfig
-- TCPConfig {host = "127.0.0.1", port = "3566"}
--
data TCPConfig
TCPConfig :: Text -> Text -> TCPConfig
[host] :: TCPConfig -> Text
[port] :: TCPConfig -> Text
-- | default
defaultTCPConfig :: TCPConfig
-- | An active TCP environment
data Env
Env :: Socket -> SockAddr -> Maybe (Async ()) -> Maybe (Async ()) -> Env
[socket] :: Env -> Socket
[sockaddr] :: Env -> SockAddr
-- | A screen dump thread
[ascreendump] :: Env -> Maybe (Async ())
-- | A file dump thread
[afiledump] :: Env -> Maybe (Async ())
-- | Connects to a server with no screen or file dump.
new :: TCPConfig -> IO Env
-- | close an Env
close :: Env -> IO ()
-- | Emits from a Socket
tcpEmitter :: Socket -> Emitter IO ByteString
-- | Commits to a Socket
tcpCommitter :: Socket -> Committer IO ByteString
-- | Box connection for a Socket
tcpBox :: Socket -> Box IO ByteString ByteString
-- | TCP server Box
tcpServer :: TCPConfig -> Box IO ByteString ByteString -> IO ()
-- | A server that explicitly responds to client messages.
tcpResponder :: TCPConfig -> (ByteString -> IO ByteString) -> IO ()
-- | A server independent of incoming messages.
tcpSender :: TCPConfig -> Emitter IO ByteString -> IO ()
-- | A TCP client connected to stdin
tcpStdClient :: TCPConfig -> IO ()
-- | test harness wrapping an action with a "q" escape.
testHarness :: IO () -> IO ()
-- | "echo: " <> Responder
testResponder :: IO ()
-- | Test server.
testServerSender :: IO ()
instance GHC.Generics.Generic Box.TCP.TCPConfig
instance GHC.Classes.Eq Box.TCP.TCPConfig
instance GHC.Show.Show Box.TCP.TCPConfig