PrivateChannel class

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

Private channels should be used when access to the channel needs to be restricted in some way. In order for a user to subscribe to a private channel permission must be authorized. The authorization occurs via a HTTP Request to a configurable authorization url when the subscribe method is called with a private- channel name.

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

See also:

Inheritance
Available Extensions

Constructors

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

Properties

authData PrivateChannelAuthorizationData?
Current authorization data of this channel.
no setterinherited
authorizationDelegate EndpointAuthorizableChannelAuthorizationDelegate<PrivateChannelAuthorizationData>
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 PrivateChannelState?
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() PrivateChannelState?
inherited
getStateWithNewStatus(ChannelStatus status) PrivateChannelState
override
getStateWithNewSubscriptionCount(int? subscriptionCount) PrivateChannelState
override
handleEvent(ChannelReadEvent event) → void
Handles events received from an instance of ChannelsManager
inherited
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(PrivateChannelState newState) → void
inherited

Operators

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