This module can be used to receive Presence messages from your Channels from anywhere in your Elm program without needing to add anything to your Model. That is all it does and all it is intended to do.
A type alias representing the joins and leaves on the Channel as they
happen.
A type alias representing the Channel topic id. For example
"topic:subTopic".
An InternalError should never happen, but if it does, it is because the
JS is out of sync with this package.
If you ever receive this message, please raise an issue.
All of the Presence messages that can come from the Channel.
If you are using more than one Channel, then you can pattern match on Topic
to determine which Channel the Msg relates to.
Subscribe to receive incoming Presence Msgs.
import Phoenix.Presence as Presence
import Ports.Phoenix as Port
type Msg
= PresenceMsg Presence.Msg
| ...
subscriptions : Model -> Sub Msg
subscriptions _ =
Presence.subscriptions
PresenceMsg
Port.presenceReceiver
A type alias representing a Presence on a Channel.
id- Theidused to identify the Presence map in the Presence.track/3 Elixir function. The recommended approach is to use the users'id.metas- A list of metadata as stored in the Presence.track/3 Elixir function.user- The user data that is pulled from the DB and stored on the Presence in the fetch/2 Elixir callback function. This is the recommended approach for storing user data on the Presence. If fetch/2 is not being used thenuserwill be equal to Json.Encode.null.presence- The whole Presence map. This provides a way to access any additional data that is stored on the Presence.