front-0.0.0.8: A reactive frontend web framework
Safe HaskellNone
LanguageHaskell2010

Web.Front.Broadcast

Synopsis

Documentation

interact :: (Data message, Data message2) => (Value -> cache model -> ClientId -> IO (Out (Action message))) -> Connection -> TChan (Out (Action message)) -> TChan (Out message2) -> cache model -> IO () -> ClientId -> IO () Source #

The common way how to use websocket Connection obtained from Handler via Conduit. interact starts two concurrent processes. First one is responsible for reading data from stream, decoding JSON message, executing custom business logic implemented by user and pushing the produced outgoing message to TChan. The second process is constantly reading from TChan, encoding the given message and pushing it to all subscribers.