Illuminate \ Broadcasting \ BroadcastException No message
First of all thank you for your great work.
I'm using your package for a few days and after some test, I could connect to my dashboard with connection to websocket.
In next step I create an event name NewQuestion that have a very simple event for test:
class NewQuestion implements ShouldBroadcast
{
use Dispatchable, InteractsWithSockets, SerializesModels;
public $message;
/**
* Create a new event instance.
*
* @return void
*/
public function __construct($message)
{
$this->message = $message;
}
/**
* Get the channels the event should broadcast on.
*
* @return \Illuminate\Broadcasting\Channel|array
*/
public function broadcastOn()
{
return new PrivateChannel('moderator');
}
}
When I simply call my event after new question store in QuestionController , laravel says:
Illuminate \ Broadcasting \ BroadcastException No message
and this is part of laravel report:
$response = $this->pusher->trigger( $this->formatChannels($channels), $event, $payload, $socket, true ); if ((is_array($response) && $response['status'] >= 200 && $response['status'] <= 299) || $response === true) { return; } throw new BroadcastException( is_bool($response) ? 'Failed to connect to Pusher.' : $response['body'] ); } /** * Get the Pusher SDK instance. * * @return \Pusher\Pusher */ public function getPusher() { return $this->pusher; }}
Would you please let me know what wrong in my case?
my configurations:
broadcasting.php:
'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' => true,
'host' => '127.0.0.1',
'port' => 6001,
'scheme' => 'https'
],
],
websockets.php:
'apps' => [
[
'id' => env('PUSHER_APP_ID'),
'name' => env('APP_NAME'),
'key' => env('PUSHER_APP_KEY'),
'secret' => env('PUSHER_APP_SECRET'),
'enable_client_messages' => false,
'enable_statistics' => true,
],
],
.
.
.
'local_cert' => '/home/myDomain/domains/myDomain.com/private_html/local.cert',
.
.
.
'local_pk' => '/home/myDomain/domains/myDomain.com/private_html/key.cert',
.
.
.
The same thing is happening to me, I will try to debug what is happening too.
@sanjarani - how is your config/broadcast file? Are you setting the host and the port?
In my case the problem was solved when I put my cert keys to a path which apache could access to those files.
I did add curl options array with this values:
'options' => [
'cluster' => env('PUSHER_APP_CLUSTER'),
'encrypted' => true,
'host' => '127.0.0.1',
'port' => 6001,
'scheme' => 'https',
'curl_options' => [
CURLOPT_SSL_VERIFYHOST => 0,
CURLOPT_SSL_VERIFYPEER => 0,
]
And then do not forget to:
php artisan cache:clear
php artisan config:clear
Hope this heal your headache because did mine ;-)
Same problem here. Did anyone solve? Thanks
Yeah have the same issue, looking at where the error comes from:
Illuminate\Broadcasting\BroadcastException in /laravel/framework/src/Illuminate/Broadcasting/Broadcasters/PusherBroadcaster.php:117
It's this line
throw new BroadcastException(
is_bool($response) ? 'Failed to connect to Pusher.' : $response['body']
);
Looks like it is still trying to connect to pusher even with the host being 127.0.01
if your working on localhost try setting your .env file
set
` APP_URL=http://localhost
DB_HOST=localhost `
and run
php artisan config:cache
hope this helps you :)
I have the same error :(
@indigoram89 have you tried my solution?
@franzgithub25 I don't understand how can it help? The application works in production as a microservice by a local network (+ public domain for UI) and this error happens a few times a day.
Guys, i found the issue. If you're on localhost, try set in broadcasting.php file PUSHER_APP_HOST to 127.0.0.1 instead of your domain that it points to and it will work.
If you're using forge - practice is the same. For javascript it stays the same window.location.hostname
In my case, it will be too many connections. Some tuning of the server solves the error.
We have the same issue. Sporadic exceptions which we drilled down to be Curl operation timeout. Currently we have no clue how to debug that issue further. There are no logs on the server side.
@indigoram89 What did you do to solve your issue and how did you find you solution?
@alichius I did next actions and it helps me:
- nginx
- /etc/nginx/nginx.conf
- worker_processes auto
- worker_connections = 10240
- worker_rlimit_nofile = 100000
- ulimit
- /etc/security/limits.conf
- {username_here} soft nofile 10240
- {username_here} hard nofile 10240
- php
- sudo pecl install ev
- php.ini (Dynamic Extensions section):
- extension=ev.so
And one more think is supervisor also has some limit on opening files and I couldn't set it up. So it working good without supervisor using screen for example.
@indigoram89 Thanks for your reply. I think that we did the first too, but we are still running with supervisor. Maybe that could be the solution. Did you find the problem in any log or how did you debuged the problem?
@alichius I soo the information about supervisor limits in the internet and just tried not use supervisor and it worked.
In my case the problem was solved when I put my
cert keysto a path which apache could access to those files.I did add
curl optionsarray with this values:'options' => [ 'cluster' => env('PUSHER_APP_CLUSTER'), 'encrypted' => true, 'host' => '127.0.0.1', 'port' => 6001, 'scheme' => 'https', 'curl_options' => [ CURLOPT_SSL_VERIFYHOST => 0, CURLOPT_SSL_VERIFYPEER => 0, ]And then do not forget to:
php artisan cache:clearphp artisan config:clearHope this heal your headache because did mine ;-)
The problem was solved for me too
@indigoram89 I have checked the limits of the websocket server process and they look good. But I think we will have a try without supervisor too.
@snowman15 It is not a permanent error. We see sporadic curl timeout exceptions a few times a day. Currently we do not use the websocket server for all customer instances but only a few for testing. For debugging purposes we modified the exception handling code and in this block we can ping the server on which the websocket process is running an we "curled" a google api which works too. What does not work ist directly sending the failed websocket request again (3 times). This throws a timeout exception again. So we assume that the websocket server process is by whatever reason not responding in this moment. But currently we have no clue why this happens or how to analyse the problem further.
I had this problem, I forgot to install the pusher php sdk. After the installation, php artisan config:clear followed by config:cache to ensure the .env is set and fresh.
That solved the problem.
ok i think this can be work