EventDispatcher
class EventDispatcher
Methods
Dispatch a message to a channel.
Notify all connections subscribed to the given channels.
Notify all connections using broadcastInternally (no cache mutation).
Dispatch an internal protocol message to a known channel instance.
Send a broadcast pipe message to all other workers on this node.
Details
at line 24
static void
dispatch(Application $app, array $payload, Connection|null $connection = null)
Dispatch a message to a channel.
at line 53
static void
dispatchSynchronously(Application $app, array $payload, Connection|null $connection = null, bool $fanOut = true)
Notify all connections subscribed to the given channels.
In single-node mode, also sends a pipe message to all other workers so they can broadcast to their local connections.
at line 92
static void
dispatchInternallySynchronously(Application $app, array $payload, Connection|null $connection = null, bool $fanOut = true)
Notify all connections using broadcastInternally (no cache mutation).
Used for internal protocol events (member_added, member_removed) that should not populate cache channel payloads.
at line 130
static void
dispatchInternalToChannel(Application $app, Channel $channel, array $payload, Connection|null $connection = null)
Dispatch an internal protocol message to a known channel instance.
Uses broadcastInternally() instead of broadcast() so cache channels don't store the payload (e.g. member_added/member_removed should not overwrite the cached event payload).
Takes the channel directly instead of resolving from the ChannelManager, since the channel may have already been removed (e.g. after vacate).
In scaling mode, publishes to Redis with an 'internal' flag so the receiving handler uses broadcastInternally() on the remote node too.
at line 161
static protected void
fanOutToOtherWorkers(Application $app, array $channels, array $payload, Connection|null $connection, bool $internal = false)
Send a broadcast pipe message to all other workers on this node.