Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

theUnforgiven's avatar

Herd/Reverb

Hi guys,

I've hit a bit of road block and wondered if you guys could help me out...

BROADCAST_CONNECTION=reverb

REVERB_APP_ID=1001
REVERB_APP_KEY=laravel-herd
REVERB_APP_SECRET=secret
REVERB_HOST="reverb.herd.test"
REVERB_PORT=443
REVERB_SCHEME=https

VITE_REVERB_APP_KEY="${REVERB_APP_KEY}"
VITE_REVERB_HOST="${REVERB_HOST}"
VITE_REVERB_PORT="${REVERB_PORT}"
VITE_REVERB_SCHEME="${REVERB_SCHEME}"

Channels.php

Broadcast::channel('audits.{userId}', function ($user, $userId) {
    return (int) $user->id === (int) $userId;
});

I run a command that dispatches an event "AuditCompleted::dispatch($audit);"

Frontend Vue 3 file:

import { useEcho } from "@laravel/echo-vue";

useEcho(
    `audits.${props.user.id}`,
    "AuditCompleted",
    (e) => {
        console.log('AuditCompleted event received:', e);
    },
);

app.ts

import { configureEcho } from '@laravel/echo-vue';

configureEcho({
    broadcaster: 'reverb',
});

I see in Herd reverb logs the events been broadcast, but the frontnend Vue 3 is not receiving the events.

0 likes
3 replies
LaryAI's avatar
Level 58

Certainly! Based on your environment variables, you’re trying to use Laravel Herd’s Reverb as your broadcast driver. Here’s a checklist and example setup to ensure everything works when you dispatch an event like AuditCompleted::dispatch($audit);.

1. Check Your .env Configuration

Your environment variables look correct. Make sure you have:

BROADCAST_CONNECTION=reverb

REVERB_APP_ID=1001
REVERB_APP_KEY=laravel-herd
REVERB_APP_SECRET=secret
REVERB_HOST="reverb.herd.test"
REVERB_PORT=443
REVERB_SCHEME=https

VITE_REVERB_APP_KEY="${REVERB_APP_KEY}"
VITE_REVERB_HOST="${REVERB_HOST}"
VITE_REVERB_PORT="${REVERB_PORT}"
VITE_REVERB_SCHEME="${REVERB_SCHEME}"

2. BroadcastServiceProvider

Ensure you have the BroadcastServiceProvider registered in config/app.php (it is by default in Laravel).

3. Event Should Broadcast

Your event should implement ShouldBroadcast. Example:

use Illuminate\Broadcasting\InteractsWithSockets;
use Illuminate\Broadcasting\PrivateChannel;
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;

class AuditCompleted implements ShouldBroadcast
{
    use InteractsWithSockets;

    public $audit;

    public function __construct($audit)
    {
        $this->audit = $audit;
    }

    public function broadcastOn()
    {
        return new PrivateChannel('audits');
    }
}

4. Broadcasting Config

In config/broadcasting.php, ensure you have the reverb connection:

'reverb' => [
    'driver' => 'reverb',
    'key' => env('REVERB_APP_KEY'),
    'secret' => env('REVERB_APP_SECRET'),
    'app_id' => env('REVERB_APP_ID'),
    'host' => env('REVERB_HOST', '127.0.0.1'),
    'port' => env('REVERB_PORT', 443),
    'scheme' => env('REVERB_SCHEME', 'https'),
    'options' => [
        'useTLS' => env('REVERB_SCHEME', 'https') === 'https',
    ],
],

5. Front-End Setup

If you’re using Laravel Echo with Vite, in your resources/js/bootstrap.js or similar:

import Echo from 'laravel-echo';

window.Echo = new Echo({
    broadcaster: 'reverb',
    key: import.meta.env.VITE_REVERB_APP_KEY,
    host: import.meta.env.VITE_REVERB_HOST,
    port: import.meta.env.VITE_REVERB_PORT,
    scheme: import.meta.env.VITE_REVERB_SCHEME,
    forceTLS: import.meta.env.VITE_REVERB_SCHEME === 'https',
});

6. Dispatching the Event

When you run:

AuditCompleted::dispatch($audit);

Make sure the queue worker is running if your event is queued:

php artisan queue:work

7. Testing

  • Open your browser’s console and check for any Echo connection errors.
  • Make sure the Reverb server is running (Herd should handle this).
  • Check storage/logs/laravel.log for any broadcasting errors.

Summary:

  • Double-check .env and config/broadcasting.php
  • Event must implement ShouldBroadcast
  • Front-end Echo config must use Vite env variables
  • Queue worker must be running if events are queued

If you have a specific error message, please share it for more targeted help!

theUnforgiven's avatar

I also see the logs from the event so it is just the frontend that appears to not be picking this up, any advice help appreciated.

Broadcasting To ........................................... private-audits.1

1▕ { 2▕  "event": "AuditCompleted", 3▕  "data": { 4▕  "id": "0197f909-b8f2-71ac-8493-83066f0c7cb1", 5▕  "url": "https://google.com", 6▕  "score": 0, 7▕  "completed_at": "2025-07-11 13:0...

Please or to participate in this conversation.