here are the steps to set up custom Pulse cards for Reverb monitoring:
1. Enable Reverb Integration in Pulse
In the `config/pulse.php` file, add the Reverb-specific recorders to the `recorders` configuration:
php
'recorders' => [
\Laravel\Reverb\Pulse\Recorders\ReverbConnections::class => [
'sample_rate' => 1,
],
\Laravel\Reverb\Pulse\Recorders\ReverbMessages::class => [
'sample_rate' => 1,
],
],
This will enable Pulse to track the number of Reverb connections and messages being handled by your server.
2. Create Custom Pulse Cards for Reverb
1. Create a new Livewire component for the Reverb card:
bash
php artisan make:livewire reverb.connections
This will generate a new Livewire component in `app/Http/Livewire/Reverb/Connections.php`.
2. Implement the Livewire component:
php
<?php
namespace App\Http\Livewire\Reverb;
use Illuminate\Support\Facades\DB;
use Laravel\Pulse\Livewire\PulseCard;
class Connections extends PulseCard
{
public function render()
{
$connections = DB::table('pulse_reverb_connections')
->orderByDesc('created_at')
->limit(10)
->get();
return view('livewire.reverb.connections', [
'connections' => $connections,
]);
}
}
3. Create the Blade view for the Reverb card:
Create a new file `resources/views/livewire/reverb/connections.blade.php` with the following content:
html
<x-pulse-card title="Reverb Connections">
<table class="w-full">
<thead>
<tr>
<th class="text-left">Connection ID</th>
<th class="text-left">Created At</th>
</tr>
</thead>
<tbody>
@foreach ($connections as $connection)
<tr>
<td>{{ $connection->key }}</td>
<td>{{ $connection->created_at }}</td>
</tr>
@endforeach
</tbody>
</table>
</x-pulse-card>
4. Add the custom Reverb card to the Pulse dashboard:
In the `resources/views/vendor/pulse/dashboard.blade.php` file, add the new Reverb card:
html
<x-pulse>
<livewire:reverb.connections cols="full" />
</x-pulse>
This will add the "Reverb Connections" card to your Pulse dashboard.
You can repeat these steps to create additional custom Pulse cards for other Reverb-related metrics, such as "Reverb Messages" or any other custom data you want to track.
By following these steps, you can seamlessly integrate Reverb monitoring into your Laravel Pulse dashboard, providing a comprehensive view of your real-time communication system's performance and health.
Citations:[1] https://www.youtube.com/watch?v=ZkvcSrgTBVM
[2] https://www.youtube.com/watch?v=wSMa-ZEAYHk
[3] https://reverb.laravel.com
[4] https://pulse.laravel.com
[5] https://laravel.com/docs/11.x/pulse