| Copyright | (c) 2016 Michael Walker |
|---|---|
| License | MIT |
| Maintainer | Michael Walker <mike@barrucadu.co.uk> |
| Stability | experimental |
| Portability | OverloadedStrings |
| Safe Haskell | None |
| Language | Haskell2010 |
Network.Pusher.WebSockets.Channel
Description
Functions for subscribing to and querying channels.
- data Channel
- subscribe :: Text -> PusherClient (Maybe Channel)
- unsubscribe :: Channel -> PusherClient ()
- members :: Channel -> PusherClient (HashMap Text Value)
- whoami :: Channel -> PusherClient Value
Documentation
Channel handle: a witness that we joined a channel, and is used to subscribe to events.
If this is used when unsubscribed from a channel, nothing will happen.
subscribe :: Text -> PusherClient (Maybe Channel) Source
Subscribe to a channel. If the channel name begins with "private-" or "presence-", authorisation is performed automatically.
This returns immediately. You should wait for the
"pusher:subscription_succeeded" event before attempting to use
presence channel functions like members and whoami.
If authorisation fails, this returns Nothing.
unsubscribe :: Channel -> PusherClient () Source
Unsubscribe from a channel.
members :: Channel -> PusherClient (HashMap Text Value) Source
Return the list of all members in a presence channel.
If we have unsubscribed from this channel, or it is not a presence channel, returns an empty map.
whoami :: Channel -> PusherClient Value Source
Return information about the local user in a presence channel.
If we have unsubscribed from this channel, or it is not a presence
channel, returns Null.