PresenceChannel class

Presence channels require users to authorized to subscribe it. So that's why it extends EndpointAuthorizableChannel with PresenceChannelAuthorizationData and requires authorizationDelegate.

Presence channels build on the security of Private channels and expose the additional feature of an awareness of who is subscribed to that channel. This makes it extremely easy to build chat room and “who’s online” type functionality to your application. Think chat rooms, collaborators on a document, people viewing the same web page, competitors in a game, that kind of thing.

It also allows users to trigger the client events using trigger method.

See also:

Inheritance
Available Extensions

Constructors

PresenceChannel.internal({required ChannelsManagerStreamGetter publicStreamGetter, required ChannelPublicEventEmitter publicEventEmitter, required ChannelsManagerConnectionDelegate connectionDelegate, required String name, required EndpointAuthorizableChannelAuthorizationDelegate<PresenceChannelAuthorizationData> authorizationDelegate})

Properties

authData PresenceChannelAuthorizationData?
Current authorization data of this channel.
no setterinherited
authorizationDelegate EndpointAuthorizableChannelAuthorizationDelegate<PresenceChannelAuthorizationData>
final
authRequestCycle int
Gives a current lifecycle of a request made to an endpoint.
no setterinherited
connectionDelegate → ChannelsManagerConnectionDelegate
A delegate that is passed by ChannelsManager. Exposes necessary API of PusherChannelsClientLifeCycleController.
final
currentStatus ChannelStatus?
Gives the current status of the state.
no setterinherited
hashCode int
The hash code for this object.
no setterinherited
name String
Name of this channel
final
publicEventEmitter → ChannelPublicEventEmitter
Delegates a sink of the ChannelsManager's StreamController.
final
publicStreamGetter ChannelsManagerStreamGetter
A atream injection applied by an instance of ChannelsManager
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
state PresenceChannelState?
A current state of this channel
no setterinherited

Methods

bind(String eventName) Stream<ChannelReadEvent>
Return a stream capturing events with respective eventName.
inherited
bindToAll() Stream<ChannelReadEvent>
Returns a stream with all the events captured by this channel.
inherited
canHandleEvent(ChannelReadEvent event) bool
inherited
getStateTest() PresenceChannelState?
inherited
getStateWithNewMembers(ChannelMembers? members) PresenceChannelState
getStateWithNewStatus(ChannelStatus status) PresenceChannelState
override
getStateWithNewSubscriptionCount(int? subscriptionCount) PresenceChannelState
override
handleEvent(ChannelReadEvent event) → void
Handles events received from an instance of ChannelsManager
override
handleOtherExternalEvents(ChannelReadEvent readEvent) → void
Passes all other events to ChannelsManager's instances' sink i.e. - publicEventEmitter
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
setAuthKeyFromDelegate() Future<void>
Sets a new lifecycle, tries to make request to get the auth data of type A.
inherited
startNewAuthRequestCycle() int
Increases the lifecycle count before making request to block changes made from the old request.
inherited
subscribe() → void
Unlike the public channels, this channel:
override
subscribeIfNotUnsubscribed() → void
Performs subscription if this channel was not unsubscibed intentionally. Recommended to use while listening for PusherChannelsClient.onConnectionEstablished
inherited
toString() String
A string representation of this object.
inherited
trigger({required String eventName, required dynamic data}) → void
Be careful with data.
inherited
unsubscribe() → void
Sends the unsubscription event through the connectionDelegate.
override
updateState(PresenceChannelState newState) → void
inherited

Operators

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