Y
Y
Yuri Kulaxyz2019-08-31 19:25:00
Laravel
Yuri Kulaxyz, 2019-08-31 19:25:00

Why is pusher not connected in Laravel application?

Illuminate \ Broadcasting \ BroadcastException
No message
This error is thrown by the application when it comes to executing this code in the controller

broadcast(new CommentCreated($comment))->toOthers();

here is a piece from 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_CLUSTER'),
                'encrypted' => false,
                'curl_options' => [
                    CURLOPT_SSL_VERIFYHOST => 0,
                    CURLOPT_SSL_VERIFYPEER => 0,
                ]

            ],
        ],

.env itself
PUSHER_APP_ID=852064
PUSHER_APP_KEY=6673f5e00bb33e0a31c7
PUSHER_APP_SECRET=336df7cb41ea7b62e6db
PUSHER_APP_CLUSTER=us2

and here is a piece from bootstrap.js
import Echo from 'laravel-echo'

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

window.Echo = new Echo({
    broadcaster: 'pusher',
    key: '6673f5e00bb33e0a31c7',
    cluster: 'us2',
    encrypted: false
});

Googled before asking, tried everything, nothing helped. For example, set encrypted to false, php artisan config:cacheadd curl_options, clear the cache, and still the same error.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
Y
Yuri Kulaxyz, 2019-08-31
@Kulaxyz

In general, I solved the problem by tracing each file in the course of script execution. It turned out that the error in the broadcasting.php file
where cluster is taken from env('PUSHER_CLUSTER)
The problem is that this field is written in the env file as PUSHER_APP_CLUSTER
Hence all the troubles, I don’t know if these settings are from the box, or I’m somewhere it's not copy-pasted, but in general be careful with this)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question