--- title: Dispatched Events order: 5 --- # Dispatched Events Laravel WebSockets takes advantage of Laravel's Event dispatching observer, in a way that you can handle in-server events outside of it. For example, you can listen for events like when a new connection establishes or when an user joins a presence channel. ## Events Below you will find a list of dispatched events: - `BlaxSoftware\LaravelWebSockets\Events\NewConnection` - when a connection successfully establishes on the server - `BlaxSoftware\LaravelWebSockets\Events\ConnectionClosed` - when a connection leaves the server - `BlaxSoftware\LaravelWebSockets\Events\SubscribedToChannel` - when a connection subscribes to a specific channel - `BlaxSoftware\LaravelWebSockets\Events\UnsubscribedFromChannel` - when a connection unsubscribes from a specific channel - `BlaxSoftware\LaravelWebSockets\Events\WebSocketMessageReceived` - when the server receives a message - `BlaxSoftware\LaravelWebSockets\EventsConnectionPonged` - when a connection pings to the server that it is still alive ## Queued Listeners Because the default Redis connection (either PhpRedis or Predis) is a blocking I/O method and can cause problems with the server speed and availability, you might want to check the [Non-Blocking Queue Driver](non-blocking-queue-driver.md) documentation that helps you create the Async Redis queue driver that is going to fix the Blocking I/O issue. If set up, you can use the `async-redis` queue driver in your listeners: ```php [ App\Listeners\HandleNewConnections::class, ], ]; ```