laravel-websockets
laravel-websockets copied to clipboard
ross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at http://sockjs-mt1.pusher.com/pusher/app//186/om7hvlep/xhr_streaming?protocol=7&client=js&version=7.0.2&t=1653565326360&n=
i got this error
cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at [http://sockjs-mt1.pusher.com/pusher/app//186/om7hvlep/xhr_streaming?protocol=7&client=js&version=7.0.2&t=1653565326360&n=](http://sockjs-mt1.pusher.com/pusher/app//186/om7hvlep/xhr_streaming?protocol=7&client=js&version=7.0.2&t=1653565326360&n=1)
here is configuration
bootstrap.js
window.Echo = new Echo({
broadcaster: 'pusher',
key: process.env.MIX_PUSHER_APP_KEY,
cluster: process.env.MIX_PUSHER_APP_CLUSTER,
wsHost: window.location.hostname,
wsPort: 6001,
forceTLS: false,
disableStats: true,
logToConsole: true
});
broadcasting.php
'pusher' => [ 'driver' => 'pusher', 'key' => env('PUSHER_APP_KEY'), 'secret' => env('PUSHER_APP_SECRET'), 'app_id' => env('PUSHER_APP_ID'), 'options' => [ 'useTLS' => false, 'cluster' => env('PUSHER_APP_CLUSTER'), 'host' => '127.0.0.1', 'port' => 6001, 'scheme' => 'http', 'encrypted' => false, ], ],
which pusher version are you using ?
no pusher i use
only "pusher/pusher-php-server": "~4.0",
i did not know why it is calling pusher even if i use Pusher Replacement
and your PHP version?
no pusher i use only
"pusher/pusher-php-server": "~4.0",
i did not know why it is calling pusher even if i use Pusher Replacement
its sort of a requirements, even other implementations like soketi still use pusherjs under the hood for laravel echo
what is the solution how i can fix that
Just add enabledTransports: ['ws', 'wss'],
in window.Echo
.
Just add
enabledTransports: ['ws', 'wss'],
inwindow.Echo
.
this not work
and your PHP version?
7.4
Just add
enabledTransports: ['ws', 'wss'],
inwindow.Echo
.this not work
Looks likes works for me. After this modification you must re-run npm run dev.