laravel / reverb

Laravel Reverb provides a real-time WebSocket communication backend for Laravel applications.
https://reverb.laravel.com
MIT License
942 stars 63 forks source link

Echo not subscribing to Reverb on production (works fine on my local) #203

Closed dev-databee closed 1 month ago

dev-databee commented 1 month ago

Reverb Version

beta

Laravel Version

10.47

PHP Version

8.2.12

Description

Echo connects to Reverb server just fine since I can sing ping/pongs

Screenshot 2024-05-22 at 10 34 44 pm

However, it doesn't seem to subscribe to events.

Dev:

Screenshot 2024-05-22 at 10 35 29 pm

Prod:

Screenshot 2024-05-22 at 10 35 48 pm

Steps To Reproduce

Subscribe to event channel on both prod and dev. Prod doesn't work, dev does.

AppLayout.vue

...
onMounted(() => {
    console.log('Subscribing to broadcast channels');
    window.Echo.private('correspondence-channel')
        .listen('SendingCorrespondence', (e) => {
            console.log(e);
        });
})
...

bootstrap.js

...
import Echo from 'laravel-echo';

import Pusher from 'pusher-js';
window.Pusher = Pusher;

window.Echo = new Echo({
    broadcaster: 'reverb',
    key: import.meta.env.VITE_REVERB_APP_KEY,
    wsHost: import.meta.env.VITE_REVERB_HOST,
    wsPort: import.meta.env.VITE_REVERB_PORT,
    wssPort: import.meta.env.VITE_REVERB_PORT,
    forceTLS: (import.meta.env.VITE_REVERB_SCHEME ?? 'https') === 'https',
    enabledTransports: ['ws', 'wss'],
});
...
dev-databee commented 1 month ago

My bad 🤦 BROADCAST_DRIVER was set to log!!!