chazsconi/elm-phoenix-ports/2.0.0

NOTE: the latest version is 2.1.0

Phoenix.Presence

Presence is an extension for channels to support the Presence feature of Phoenix.

Definition

type alias Presence msg =
PhoenixPresence msg

Representation of a Presence configuration

Helpers

create : PhoenixPresence msg

Create a Presence configuration

(Dict String (List Value) -> msg)
-> PhoenixPresence msg
-> PhoenixPresence msg

This will be called each time the Presence state changes. The Dict contains as keys your presence keys and as values a list of the payloads you sent from the server. If you have on the elixir side Presence.track(socket, user_name, %{online_at: now()}) then an example would be a Dict with

{ "user1": [{online_at: 1491493666123}]
, "user2": [{online_at: 1491492646123}, {online_at: 1491492646624}]
}
(Dict String (List Value) -> msg)
-> PhoenixPresence msg
-> PhoenixPresence msg

This will be called each time user some user joins. This callback is useful to have special events if a user joins. To obtain a list of all users use onChange.

(Dict String (List Value) -> msg)
-> PhoenixPresence msg
-> PhoenixPresence msg

This will be called each time user some user leaves. This callback is useful to have special events if a user leaves. To obtain a list of all users use onChange.

map : (a -> b) -> PhoenixPresence a -> PhoenixPresence b

Maps the callbacks