websockets-0.7.0.1: A sensible and clean way to write WebSocket-capable servers in Haskell.

Safe HaskellNone

Network.WebSockets.Util.PubSub

Description

This is a simple utility module to implement a publish-subscribe pattern. Note that this only allows communication in a single direction: pusing data from the server to connected clients (browsers).

Usage:

Synopsis

Documentation

data PubSub p Source

A handle which keeps track of subscribed clients

newPubSub :: IO (PubSub p)Source

Create a new PubSub handle, with no clients initally connected

publish :: PubSub p -> Message p -> IO ()Source

Broadcast a message to all connected clients

subscribe :: Protocol p => PubSub p -> WebSockets p ()Source

Blocks forever