Safe Haskell | None |
---|---|
Language | Haskell2010 |
- type WSConnectionIO f a = ReaderT Connection (f IO) a
- decodeWith :: WebSocketsData a => (a -> b) -> (IO b -> m c) -> ReaderT Connection m c
- decode :: FromJSON a => WSConnectionIO (EitherT String) a
- decode' :: FromJSON a => WSConnectionIO (EitherT String) a
- stratuxApp :: (WebSocketsData t, WebSocketsData u) => (t -> IO b) -> u -> ClientApp ()
- trafficAppWith :: (WebSocketsData t, WebSocketsData u) => (t -> Either String Traffic) -> String -> Int -> (Either String Traffic -> IO b) -> u -> IO ()
- trafficApp :: WebSocketsData u => String -> Int -> (Either String Traffic -> IO b) -> u -> IO ()
- trafficApp' :: WebSocketsData u => String -> Int -> (Either String Traffic -> IO b) -> u -> IO ()
Documentation
type WSConnectionIO f a = ReaderT Connection (f IO) a Source #
decodeWith :: WebSocketsData a => (a -> b) -> (IO b -> m c) -> ReaderT Connection m c Source #
Decode from JSON anything received on the websocket.
decode :: FromJSON a => WSConnectionIO (EitherT String) a Source #
Decode from JSON anything received on the websocket. Parses immediately, but defers conversion.
decode' :: FromJSON a => WSConnectionIO (EitherT String) a Source #
Decode from JSON anything received on the websocket. Parses and performs conversion immediately.
:: (WebSocketsData t, WebSocketsData u) | |
=> (t -> IO b) | The function to run on each receive of data on the websocket. |
-> u | The connection close traffic. |
-> ClientApp () |
A stratux websockets application. Loops receiving data and waits for input from stdin. An empty line to stdin terminates the program loop.
:: (WebSocketsData t, WebSocketsData u) | |
=> (t -> Either String Traffic) | Data to traffic. |
-> String | host. |
-> Int | port. |
-> (Either String Traffic -> IO b) | For each traffic message. |
-> u | The connection close traffic. |
-> IO () |
Decodes JSON to stratux traffic.