class EventHandler

Methods

__construct(ChannelManager $channels)

Create a new Pusher event instance.

void
handle(Connection $connection, string $event, array $payload = [])

Handle an incoming Pusher event.

void
acknowledge(Connection $connection)

Acknowledge the connection.

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

Subscribe to the given channel.

void
afterSubscribe(Channel $channel, Connection $connection)

Carry out any actions that should be performed after a subscription.

void
unsubscribe(Connection $connection, string $channel)

Unsubscribe from the given channel.

void
sendCachedPayload(CacheChannel $channel, Connection $connection)

Send the cached payload for the given channel.

void
pong(Connection $connection)

Respond to a ping on the given connection.

void
ping(Connection $connection)

Send a ping to the given connection.

void
send(Connection $connection, string $event, array $data = [], string|null $channel = null)

Send a response to the given connection.

void
sendInternally(Connection $connection, string $event, array $data = [], string|null $channel = null)

Send an internal response to the given connection.

string
formatPayload(string $event, array $data = [], string|null $channel = null, string $prefix = 'pusher:')

Format the payload for the given event.

string
formatInternalPayload(string $event, array $data = [], string|null $channel = null)

Format the internal payload for the given event.

Details

at line 21
__construct(ChannelManager $channels)

Create a new Pusher event instance.

Parameters

ChannelManager $channels

at line 28
void handle(Connection $connection, string $event, array $payload = [])

Handle an incoming Pusher event.

Parameters

Connection $connection
string $event
array $payload

Return Value

void

at line 50
void acknowledge(Connection $connection)

Acknowledge the connection.

Parameters

Connection $connection

Return Value

void

at line 61
void subscribe(Connection $connection, string $channel, string|null $auth = null, string|null $data = null)

Subscribe to the given channel.

Parameters

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

Return Value

void

at line 79
protected void afterSubscribe(Channel $channel, Connection $connection)

Carry out any actions that should be performed after a subscription.

Parameters

Channel $channel
Connection $connection

Return Value

void

at line 92
void unsubscribe(Connection $connection, string $channel)

Unsubscribe from the given channel.

Parameters

Connection $connection
string $channel

Return Value

void

at line 103
protected void sendCachedPayload(CacheChannel $channel, Connection $connection)

Send the cached payload for the given channel.

Parameters

CacheChannel $channel
Connection $connection

Return Value

void

at line 127
void pong(Connection $connection)

Respond to a ping on the given connection.

Parameters

Connection $connection

Return Value

void

at line 135
void ping(Connection $connection)

Send a ping to the given connection.

Parameters

Connection $connection

Return Value

void

at line 147
void send(Connection $connection, string $event, array $data = [], string|null $channel = null)

Send a response to the given connection.

Parameters

Connection $connection
string $event
array $data
string|null $channel

Return Value

void

at line 157
void sendInternally(Connection $connection, string $event, array $data = [], string|null $channel = null)

Send an internal response to the given connection.

Parameters

Connection $connection
string $event
array $data
string|null $channel

Return Value

void

at line 167
string formatPayload(string $event, array $data = [], string|null $channel = null, string $prefix = 'pusher:')

Format the payload for the given event.

Parameters

string $event
array $data
string|null $channel
string $prefix

Return Value

string

at line 182
string formatInternalPayload(string $event, array $data = [], string|null $channel = null)

Format the internal payload for the given event.

Parameters

string $event
array $data
string|null $channel

Return Value

string