Laravel-websockets: laravel websocket give me this error. i try tree day to fix it, any one in there fix like this plece help me if you can

Created on 20 May 2020  路  4Comments  路  Source: beyondcode/laravel-websockets

WebSocket connection to 'wss://127.0.0.1/app/anyKey?protocol=7&client=js&version=6.0.3&flash=false' failed: Error in connection establishment: net::ERR_CERT_AUTHORITY_INVALID

Access to XMLHttpRequest at 'https://sockjs.pusher.com/pusher/app/anyKey/34/7qd33bkn/xhr_streaming?protocol=7&client=js&version=6.0.3&t=1589962704756&n=1' from origin 'http://127.0.0.1:8000' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.

bellow URL gives me a 404 error.

app.js:42245 POST https://sockjs.pusher.com/pusher/app/anyKey/34/7qd33bkn/xhr_streaming?protocol=7&client=js&version=6.0.3&t=1589962704756&n=1 net::ERR_FAILED

I try it my localhost.

.ENV

BROADCAST_DRIVER=pusher

PUSHER_APP_ID=anyID
PUSHER_APP_KEY=anyKey
PUSHER_APP_SECRET=anySecret

//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,
'host' => '127.0.0.1',
'port' => 6001,
'scheme' => 'http'
],
],

//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,
wsHost: window.location.hostname,
wsPort: 6001,
disableStats: true,
});

Most helpful comment

php
'useTLS' => false,

js
disableStats: true,
forceTLS: false,

All 4 comments

php
'useTLS' => false,

js
disableStats: true,
forceTLS: false,

What about it happened in web server?
I have this problem in web?
Please help.
Thanks

@shaikhfoysal Prior to Pusher v6, the forceTLS variable is enabled and in case you have no SSL set up, you will need to turn that into a false.

@shaikhfoysal
in your bootstap.js( resources/js/bootstrap.js )
forceTLS option false if you not have ssl set up

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ElegantSoft picture ElegantSoft  路  4Comments

NIkita-Kim picture NIkita-Kim  路  4Comments

ahmed-aliraqi picture ahmed-aliraqi  路  4Comments

semsphy picture semsphy  路  3Comments

fridzema picture fridzema  路  4Comments