Skip to content

Commit 5cd32f4

Browse files
[12.x] Add Reverb events documentation (#10954)
* [12.x] Add Reverb events documentation * formatting --------- Co-authored-by: Taylor Otwell <[email protected]>
1 parent 978d4ca commit 5cd32f4

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

reverb.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
- [Ports](#ports)
1919
- [Process Management](#process-management)
2020
- [Scaling](#scaling)
21+
- [Events](#events)
2122

2223
<a name="introduction"></a>
2324
## Introduction
@@ -316,3 +317,30 @@ REVERB_SCALING_ENABLED=true
316317
Next, you should have a dedicated, central Redis server to which all of the Reverb servers will communicate. Reverb will use the [default Redis connection configured for your application](/docs/{{version}}/redis#configuration) to publish messages to all of your Reverb servers.
317318

318319
Once you have enabled Reverb's scaling option and configured a Redis server, you may simply invoke the `reverb:start` command on multiple servers that are able to communicate with your Redis server. These Reverb servers should be placed behind a load balancer that distributes incoming requests evenly among the servers.
320+
321+
<a name="events"></a>
322+
## Events
323+
324+
Reverb dispatches internal events during the lifecycle of a connection and message handling. You may [listen for these events](/docs/{{version}}/events) to perform actions when connections are managed or messages are exchanged.
325+
326+
The following events are dispatched by Reverb:
327+
328+
#### `Laravel\Reverb\Events\ChannelCreated`
329+
330+
Dispatched when a channel is created. This typically occurs when the first connection subscribes to a specific channel. The event receives the `Laravel\Reverb\Protocols\Pusher\Channel` instance.
331+
332+
#### `Laravel\Reverb\Events\ChannelRemoved`
333+
334+
Dispatched when a channel is removed. This typically occurs when the last connection unsubscribes from a channel. The event receives the `Laravel\Reverb\Protocols\Pusher\Channel` instance.
335+
336+
#### `Laravel\Reverb\Events\ConnectionPruned`
337+
338+
Dispatched when a stale connection is pruned by the server. The event receives the `Laravel\Reverb\Contracts\Connection` instance.
339+
340+
#### `Laravel\Reverb\Events\MessageReceived`
341+
342+
Dispatched when a message is received from a client connection. The event receives the `Laravel\Reverb\Contracts\Connection` instance and the raw string `$message`.
343+
344+
#### `Laravel\Reverb\Events\MessageSent`
345+
346+
Dispatched when a message is sent to a client connection. The event receives the `Laravel\Reverb\Contracts\Connection` instance and the raw string `$message`.

0 commit comments

Comments
 (0)