laravelpusherlaravel-websockets

Unable to configure laravel websocket with laravel 9


Is there any issue with laravel 9 im not getting the api message on my dashboard nither my Echo is listening

.env

BROADCAST_DRIVER=pusher
QUEUE_CONNECTION=sync

PUSHER_APP_ID=123
PUSHER_APP_KEY=p123
PUSHER_APP_SECRET=s123
PUSHER_HOST='127.0.0.1'
PUSHER_PORT=443
PUSHER_SCHEME=https
PUSHER_APP_CLUSTER=mt1

VITE_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
VITE_PUSHER_HOST="${PUSHER_HOST}"
VITE_PUSHER_PORT="${PUSHER_PORT}"
VITE_PUSHER_SCHEME="${PUSHER_SCHEME}"
VITE_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"

Echo

import Echo from 'laravel-echo';
import Pusher from 'pusher-js';

window.Pusher = Pusher;

window.Echo = new Echo({
    broadcaster: 'pusher',
    key: import.meta.env.VITE_PUSHER_APP_KEY,
    cluster: import.meta.env.VITE_PUSHER_APP_CLUSTER,
    wsHost: window.location.hostname,
    wsPort: 6001,
    forceTLS: false,
    disableStats: true,
    encrypted: false,
});

my dashboard shows subscribed but the api message are not showing on the dashboard nither the Echo server is listening to the event


Solution

    1. Change env PUSHER_PORT=443 to PUSHER_PORT=6001
    2. Higher versions of pusher-php 7.2 and laravel-websockets 1.13 are incompatible. So, downgrade pusher to 7.0. You can use this to install pusher version 7.0 composer require pusher/pusher-php-server:7.0 -W
    3. You may need to change env PUSHER_SCHEME=https to PUSHER_SCHEME=http for your local enviroment