class EventDispatcher

Methods

static void
dispatch(Application $app, array $payload, Connection|null $connection = null)

Dispatch a message to a channel.

static void
dispatchSynchronously(Application $app, array $payload, Connection|null $connection = null, bool $fanOut = true)

Notify all connections subscribed to the given channels.

static void
dispatchInternallySynchronously(Application $app, array $payload, Connection|null $connection = null, bool $fanOut = true)

Notify all connections using broadcastInternally (no cache mutation).

static void
dispatchInternalToChannel(Application $app, Channel $channel, array $payload, Connection|null $connection = null)

Dispatch an internal protocol message to a known channel instance.

static 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.

Details

at line 24
static void dispatch(Application $app, array $payload, Connection|null $connection = null)

Dispatch a message to a channel.

Parameters

Application $app
array $payload
Connection|null $connection

Return Value

void

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.

Parameters

Application $app
array $payload
Connection|null $connection
bool $fanOut

Return Value

void

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.

Parameters

Application $app
array $payload
Connection|null $connection
bool $fanOut

Return Value

void

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.

Parameters

Application $app
Channel $channel
array $payload
Connection|null $connection

Return Value

void

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.

Parameters

Application $app
array $channels
array $payload
Connection|null $connection
bool $internal

Return Value

void