PrivateChannel
class PrivateChannel extends Channel
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 |
Methods
Subscribe to the given channel.
Handle channel occupied — dispatch events, check disconnect smoothing.
Get the result from the most recent subscribe/unsubscribe shared state call.
Handle channel vacated — remove from manager, dispatch events, clean up locks.
Dispatch the subscription_count webhook if enabled and not throttled.
Send a message to all connections subscribed to the channel.
Broadcast a message triggered from an internal source.
Determine whether the given authentication token is valid.
Details
in
SerializesChannels at line 16
array
__serialize()
Prepare the channel instance values for serialization.
in
SerializesChannels at line 26
void
__unserialize(array $values)
Restore the channel after serialization.
in
Channel at line 36
__construct(string $name)
Create a new channel instance.
in
Channel at line 44
string
name()
Get the channel name.
in
Channel at line 54
array
connections()
Get all connections for the channel.
in
Channel at line 62
ChannelConnection|null
find(Connection $connection)
Find a connection.
in
Channel at line 70
ChannelConnection|null
findById(string $id)
Find a connection by its ID.
in
InteractsWithPrivateChannels at line 16
void
subscribe(Connection $connection, string|null $auth = null, string|null $data = null, string|null $userId = null)
Subscribe to the given channel.
in
Channel at line 102
protected void
handleChannelOccupied(Connection $connection, SharedState $sharedState)
Handle channel occupied — dispatch events, check disconnect smoothing.
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.
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.
in
Channel at line 176
protected void
handleChannelVacated(Connection $connection)
Handle channel vacated — remove from manager, dispatch events, clean up locks.
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.
in
Channel at line 246
bool
subscribed(Connection $connection)
Determine if the connection is subscribed to the channel.
in
Channel at line 254
void
broadcast(array $payload, Connection|null $except = null)
Send a message to all connections subscribed to the channel.
in
Channel at line 279
void
broadcastToAll(array $payload)
Send a broadcast to all connections.
in
Channel at line 294
void
broadcastInternally(array $payload, Connection|null $except = null)
Broadcast a message triggered from an internal source.
in
Channel at line 302
array
data()
Get the data associated with the channel.
in
InteractsWithPrivateChannels at line 26
protected bool
verify(Connection $connection, string|null $auth = null, string|null $data = null)
Determine whether the given authentication token is valid.