I am using the laravel-websockets and pusher packages to run a simple chat feature inside my application. I managed to make it work locally using the ssl certificates of the valet dev environment. Right now, I am in the final phase of development, I put my application on my VPS server, created ssl certificates, everything works perfectly but I cannot get the websockets server to work. I am using an ubuntu server with plesk and I run my application through the nginx. Currently Getting this error in the console
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'),
'useTLS' => true,
'encrypted' => true,
'host' => '127.0.0.1',
'port' => 6001,
'scheme' => 'https',
'curl_options' => [
CURLOPT_SSL_VERIFYHOST => 0,
CURLOPT_SSL_VERIFYPEER => 0,
]
],
],
bootstrap.js
import Echo from 'laravel-echo';
window.Pusher = require('pusher-js');
window.Echo = new Echo({
broadcaster: 'pusher',
wsHost: window.location.hostname,
wsPort: 6001,
wssPort: 6001,
key: process.env.MIX_PUSHER_APP_KEY,
cluster: process.env.MIX_PUSHER_APP_CLUSTER,
disableStats: true,
forceTLS: true
});
.env (I am going to change the pusher credentials in production)
PUSHER_APP_ID=12345
PUSHER_APP_KEY=ABCDEFG
PUSHER_APP_SECRET=HIJKLMNOP
PUSHER_APP_CLUSTER=mt1
LARAVEL_WEBSOCKETS_SSL_LOCAL_CERT=localhost.crt
LARAVEL_WEBSOCKETS_SSL_LOCAL_PK=localhost.key
MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"