class PrivateCacheChannel extends CacheChannel

Traits

Properties

protected ChannelConnectionManager $connections

The channel connections.

from  Channel
protected SubscriptionResult $lastSubscriptionResult

The result from the most recent shared state subscribe/unsubscribe call.

from  Channel
protected array|null $payload

Data from last event triggered.

from  CacheChannel

Methods

array
__serialize()

Prepare the channel instance values for serialization.

void
__unserialize(array $values)

Restore the channel after serialization.

__construct(string $name)

Create a new channel instance.

from  Channel
string
name()

Get the channel name.

from  Channel
array
connections()

Get all connections for the channel.

from  Channel
find(Connection $connection)

Find a connection.

from  Channel
findById(string $id)

Find a connection by its ID.

from  Channel
void
subscribe(Connection $connection, string|null $auth = null, string|null $data = null, string|null $userId = null)

Subscribe to the given channel.

void
handleChannelOccupied(Connection $connection, SharedState $sharedState)

Handle channel occupied — dispatch events, check disconnect smoothing.

from  Channel
lastSubscriptionResult()

Get the result from the most recent subscribe/unsubscribe shared state call.

from  Channel
void
unsubscribe(Connection $connection, string|null $userId = null)

Unsubscribe from the given channel.

from  Channel
void
handleChannelVacated(Connection $connection)

Handle channel vacated — remove from manager, dispatch events, clean up locks.

from  Channel
void
dispatchSubscriptionCountWebhook(Connection $connection)

Dispatch the subscription_count webhook if enabled and not throttled.

from  Channel
bool
subscribed(Connection $connection)

Determine if the connection is subscribed to the channel.

from  Channel
void
broadcast(array $payload, Connection|null $except = null)

Send a message to all connections subscribed to the channel.

void
broadcastToAll(array $payload)

Send a broadcast to all connections.

from  Channel
void
broadcastInternally(array $payload, Connection|null $except = null)

Broadcast a message triggered from an internal source.

array
data()

Get the data associated with the channel.

from  Channel
bool
hasCachedPayload()

Determine if the channel has a cached payload.

array|null
cachedPayload()

Get the cached payload.

bool
verify(Connection $connection, string|null $auth = null, string|null $data = null)

Determine whether the given authentication token is valid.

Details

in SerializesChannels at line 16
array __serialize()

Prepare the channel instance values for serialization.

Return Value

array

in SerializesChannels at line 26
void __unserialize(array $values)

Restore the channel after serialization.

Parameters

array $values

Return Value

void

in Channel at line 36
__construct(string $name)

Create a new channel instance.

Parameters

string $name

in Channel at line 44
string name()

Get the channel name.

Return Value

string

in Channel at line 54
array connections()

Get all connections for the channel.

Return Value

array

in Channel at line 62
ChannelConnection|null find(Connection $connection)

Find a connection.

Parameters

Connection $connection

Return Value

ChannelConnection|null

in Channel at line 70
ChannelConnection|null findById(string $id)

Find a connection by its ID.

Parameters

string $id

Return Value

ChannelConnection|null

void subscribe(Connection $connection, string|null $auth = null, string|null $data = null, string|null $userId = null)

Subscribe to the given channel.

Parameters

Connection $connection
string|null $auth
string|null $data
string|null $userId

Return Value

void

in Channel at line 102
protected void handleChannelOccupied(Connection $connection, SharedState $sharedState)

Handle channel occupied — dispatch events, check disconnect smoothing.

Parameters

Connection $connection
SharedState $sharedState

Return Value

void

in Channel at line 146
protected SubscriptionResult lastSubscriptionResult()

Get the result from the most recent subscribe/unsubscribe shared state call.

Used by presence channel traits to check memberAdded/memberRemoved.

Return Value

SubscriptionResult

in Channel at line 156
void unsubscribe(Connection $connection, string|null $userId = null)

Unsubscribe from the given channel.

Presence channels pass the userId for global refcount tracking.

Parameters

Connection $connection
string|null $userId

Return Value

void

in Channel at line 176
protected void handleChannelVacated(Connection $connection)

Handle channel vacated — remove from manager, dispatch events, clean up locks.

Parameters

Connection $connection

Return Value

void

in Channel at line 218
protected void dispatchSubscriptionCountWebhook(Connection $connection)

Dispatch the subscription_count webhook if enabled and not throttled.

Fires on every subscribe/unsubscribe for non-presence channels. Throttled to once per 5 seconds for channels with >100 subscribers.

Parameters

Connection $connection

Return Value

void

in Channel at line 246
bool subscribed(Connection $connection)

Determine if the connection is subscribed to the channel.

Parameters

Connection $connection

Return Value

bool

in CacheChannel at line 19
void broadcast(array $payload, Connection|null $except = null)

Send a message to all connections subscribed to the channel.

Parameters

array $payload
Connection|null $except

Return Value

void

in Channel at line 279
void broadcastToAll(array $payload)

Send a broadcast to all connections.

Parameters

array $payload

Return Value

void

in CacheChannel at line 29
void broadcastInternally(array $payload, Connection|null $except = null)

Broadcast a message triggered from an internal source.

Parameters

array $payload
Connection|null $except

Return Value

void

in Channel at line 302
array data()

Get the data associated with the channel.

Return Value

array

in CacheChannel at line 37
bool hasCachedPayload()

Determine if the channel has a cached payload.

Return Value

bool

in CacheChannel at line 45
array|null cachedPayload()

Get the cached payload.

Return Value

array|null

protected bool verify(Connection $connection, string|null $auth = null, string|null $data = null)

Determine whether the given authentication token is valid.

Parameters

Connection $connection
string|null $auth
string|null $data

Return Value

bool