laravel-websockets icon indicating copy to clipboard operation
laravel-websockets copied to clipboard

Unable to receive event in production server

Open michele-grifa opened this issue 3 years ago • 0 comments

I have a problem receiving events in a production server. The Echo client connect to server without errors, but when i try to broadcast an event or a notification, no event is triggered on the client side.

I tried also to change the queue driver from redis to sync, without success. When i broadcast the event, in the console logging, there is only the connection established logging and a pusher:pong logging, but not for the event.

The same configuration works perfectly on a local environment.

Pusher PHP Server: 5.0.3 Laravel Websockets: 1.13.1 Laravel: 8.83.23 Laravel Echo: 1.11.1

.env

BROADCAST_DRIVER=pusher
CACHE_DRIVER=file
FILESYSTEM_DRIVER=local
QUEUE_CONNECTION=redis
SESSION_DRIVER=file
SESSION_LIFETIME=120

PUSHER_APP_ID=12345
PUSHER_APP_KEY=12345
PUSHER_APP_SECRET=12345
PUSHER_APP_CLUSTER=mt1

broadcasting.php

'connections' => [

        'pusher' => [
            'driver' => 'pusher',
            'key' => env('PUSHER_APP_KEY'),
            'secret' => env('PUSHER_APP_SECRET'),
            'app_id' => env('PUSHER_APP_ID'),
            'options' => [
                'cluster' => env('PUSHER_APP_CLUSTER'),
                'encrypted' => false,
                'host' => '127.0.0.1',
                'port' => 6001,
                'scheme' => 'http',
                'useTLS' => false,
            ],
        ],

bootstrap.js

import Echo from 'laravel-echo';

window.Pusher = require('pusher-js');

window.Echo = new Echo({
    broadcaster: 'pusher',
    key: process.env.MIX_PUSHER_APP_KEY,
    cluster: process.env.MIX_PUSHER_APP_CLUSTER,
    forceTLS: false,
    encrypted: false,
    wsHost: window.location.hostname,
    wsPort: 6001,
});

michele-grifa avatar Jul 26 '22 15:07 michele-grifa