app-bc5b78c1.js:9 WebSocket connection to 'wss://****.com:6001/app/key?protocol=7&client=js&version=7.6.0&flash=false' failed: WebSocket is closed before the connection is established.
I'm use laravel 10 and beyondcode/laravel-websockets package its work in localhost but dont work in hostinger Premium Web Hosting
config/broadcasting.php file
'driver' => 'pusher',
'key' => env('PUSHER_APP_KEY'),
'secret' => env('PUSHER_APP_SECRET'),
'app_id' => env('PUSHER_APP_ID'),
'options' => [
'cluster' => 'ap2',
'encrypted' => true,
'host' => '****.com',
'port' => 6001,
'scheme' => 'https',
'useTLS' => true
],
resources/js/bootstrap.js file
import Echo from 'laravel-echo';
import Pusher from 'pusher-js';
window.Pusher = Pusher;
window.Echo = new Echo({
broadcaster: 'pusher',
key: 'key',
cluster: "ap2",
wsHost: '****.com',
wsPort: 6001,
wssPort: 6001,
forceTLS: true,
disableStats: true,
enabledTransports: ['ws', 'wss'],
});
and run websocket with
php artisan websockets:serve
and use livewire with laravel
Note its work with pusher without this package
I tried to use the site without https and it didn't work