laravel-websockets icon indicating copy to clipboard operation
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=

Open mahmoud-elhawy opened this issue 2 years ago • 9 comments

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, ], ], Screenshot from 2022-05-26 13-39-24

mahmoud-elhawy avatar May 26 '22 11:05 mahmoud-elhawy

which pusher version are you using ?

peterson-umoke avatar May 31 '22 09:05 peterson-umoke

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

mahmoud-elhawy avatar May 31 '22 12:05 mahmoud-elhawy

and your PHP version?

peterson-umoke avatar May 31 '22 12:05 peterson-umoke

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

peterson-umoke avatar May 31 '22 12:05 peterson-umoke

what is the solution how i can fix that

mahmoud-elhawy avatar May 31 '22 15:05 mahmoud-elhawy

Just add enabledTransports: ['ws', 'wss'], in window.Echo.

GarryLai avatar Aug 19 '22 16:08 GarryLai

Just add enabledTransports: ['ws', 'wss'], in window.Echo.

this not work

mahmoud-elhawy avatar Aug 21 '22 08:08 mahmoud-elhawy

and your PHP version?

7.4

mahmoud-elhawy avatar Aug 21 '22 08:08 mahmoud-elhawy

Just add enabledTransports: ['ws', 'wss'], in window.Echo.

this not work

Looks likes works for me. After this modification you must re-run npm run dev.

jomisacu avatar Aug 24 '22 23:08 jomisacu