PhoenixPresence class

A Phoenix Presence client to interact with a backend Phoenix Channel implementing the Presence module. https://hexdocs.pm/phoenix/presence.html

Constructors

PhoenixPresence({required PhoenixChannel channel, Map<String, String> eventNames = const {'state' : 'presence_state', 'diff' : 'presence_diff'}})
Attaches a Phoenix Presence client to listen to new presence messages on an existing channel.

Properties

channel PhoenixChannel
A Phoenix Channel which implements the Phoenix Presence module on the backend.
final
diffEventName String
Gets the name of the 'diff' event to listen to if different than the default 'presence_diff'.
no setter
eventNames Map<String, String>
A custom map of event names to listen to on the channel. Defaults to the standard Phoenix Presence events names:
final
hashCode int
The hash code for this object.
no setterinherited
inPendingSyncState bool
Checks whether the presence channel is currently syncing with the server.
no setter
onJoin JoinHandler
Optional callback to react to changes in the client's local presences when connecting/reconnecting with the server.
getter/setter pair
onLeave LeaveHandler
Optional callback to react to changes in the client's local presences when disconnecting from the server.
getter/setter pair
onSync ↔ dynamic Function()
Optional callback triggered after a Presence message/event has been processed.
getter/setter pair
pendingDiffs List<Map<String, Map<String, Presence>>>
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
state Map<String, Presence>
All presences advertised by the Phoenix backend in real time.
getter/setter pair
stateEventName String
Gets the name of the 'state' event to listen to if different than the default 'presence_state'.
no setter

Methods

dispose() → void
Stops listening to new messages on channel.
list(Map<String, Presence> presences, [dynamic chooser(String, Presence)?]) List
Returns the array of presences, with selected metadata formatted according to the chooser function. See Example for better understanding and implementation details.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited