stratux-websockets-0.0.8: A library for using websockets with stratux

Safe HaskellNone
LanguageHaskell2010

Data.Aviation.Stratux.Websockets

Synopsis

Documentation

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.

stratuxApp Source #

Arguments

:: (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.

trafficAppWith Source #

Arguments

:: (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.

trafficApp Source #

Arguments

:: WebSocketsData u 
=> String

host.

-> Int

port.

-> (Either String Traffic -> IO b)

For each traffic message.

-> u

The connection close traffic.

-> IO () 

Decodes JSON to stratux traffic. Parses immediately, but defers conversion.

trafficApp' Source #

Arguments

:: WebSocketsData u 
=> String

host.

-> Int

port.

-> (Either String Traffic -> IO b)

For each traffic message.

-> u

The connection close traffic.

-> IO () 

Decodes JSON to stratux traffic. Parses and performs conversion immediately.