hydra-node
Safe HaskellSafe-Inferred
LanguageGHC2021

Hydra.API.WSServer

Synopsis

Documentation

data WsCodec tx Source #

Per-connection codec: resolves the negotiated wire encoding and the snapshot-utxo display policy once, so message handling needs no dispatch.

mkWsCodec :: IsChainState tx => ServerOutputConfig -> Connection -> WsCodec tx Source #

Resolve the negotiated encoding into a WsCodec. This is the only place deciding how messages go onto (and come off) the wire: JSON as text frames, CBOR as binary frames.

NOTE: Inputs are decoded per the negotiated encoding, never the frame type: some JSON clients (e.g. the TUI) send binary frames containing JSON.

wsApp Source #

Arguments

:: forall tx. IsChainState tx 
=> Environment 
-> Party 
-> Tracer IO APIServerLog 
-> Chain tx IO 
-> ConduitT () (TimedServerOutput tx) (ResourceT IO) () 
-> (ClientInput tx -> IO ()) 
-> Projection STM (StateChanged tx) (NodeState tx)

Read model to enhance Greetings messages with HeadStatus.

-> Projection STM (StateChanged tx) NetworkInfo

Read model to enhance Greetings messages with NetworkInfo.

-> TChan (Either (TimedServerOutput tx) (ClientMessage tx)) 
-> ServerOutputFilter tx 
-> PendingConnection 
-> IO () 

queryParamsOf :: ByteString -> Query Source #

The query parameters of a websocket connection request path.

NOTE: a malformed query string yields no parameters here, and hence the default output config. modern-uri (used here previously) raised a parse exception during connection setup instead.

mkServerOutputConfig :: Query -> ServerOutputConfig Source #

Decide what a client wants to see, from the query string of its connection.