tlaverdure / laravel-echo-server

Socket.io server for Laravel Echo
MIT License
2.65k stars 510 forks source link

help , Is this a bug? #557

Open hgaoping opened 3 years ago

hgaoping commented 3 years ago

I have been using Laravel 5.8 and can use the laravel-echo function normally

Reinstalled today and found that the software package was updated, and the following problems occurred

微信截图_20210106202510
hgaoping commented 3 years ago

Access to XMLHttpRequest at 'http://www.v10.com:6001/socket.io/?EIO=3&transport=polling&t=NRNfdTe' from origin 'http://www.v10.com' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.

hgaoping commented 3 years ago

this is my laravel-echo-server.json

{ "authHost": "http://www.v10.com", "authEndpoint": "/broadcasting/auth", "clients": [], "database": "redis", "databaseConfig": { "redis": {}, "sqlite": { "databasePath": "/database/laravel-echo-server.sqlite" } }, "devMode": false, "host": null, "port": "6001", "protocol": "http", "socketio": {}, "secureOptions": 67108864, "sslCertPath": "", "sslKeyPath": "", "sslCertChainPath": "", "sslPassphrase": "", "subscribers": { "http": true, "redis": true }, "apiOriginAllow": { "allowCors": true, "allowOrigin": "http://www.v10.com", "allowMethods": "GET, POST", "allowHeaders": "Origin, Content-Type, X-Auth-Token, X-Requested-With, Accept, Authorization, X-CSRF-TOKEN, X-Socket-Id" } }

idanalkhalid commented 3 years ago

i got same issue

idanalkhalid commented 3 years ago

this is my laravel-echo-server.json

{ "authHost": "http://www.v10.com", "authEndpoint": "/broadcasting/auth", "clients": [], "database": "redis", "databaseConfig": { "redis": {}, "sqlite": { "databasePath": "/database/laravel-echo-server.sqlite" } }, "devMode": false, "host": null, "port": "6001", "protocol": "http", "socketio": {}, "secureOptions": 67108864, "sslCertPath": "", "sslKeyPath": "", "sslCertChainPath": "", "sslPassphrase": "", "subscribers": { "http": true, "redis": true }, "apiOriginAllow": { "allowCors": true, "allowOrigin": "http://www.v10.com", "allowMethods": "GET, POST", "allowHeaders": "Origin, Content-Type, X-Auth-Token, X-Requested-With, Accept, Authorization, X-CSRF-TOKEN, X-Socket-Id" } }

hi i got solution, you need runing laravel-echo-server init..you can't edit from laravel-echo-server.json

referense https://mrkaluzny.com/blog/using-laravel-echo-with-socket-io-and-vue-spa/

ghost commented 3 years ago

also getting this issue, it appears to be related to the new changes to socket.io.

idanalkhalid commented 3 years ago

also getting this issue, it appears to be related to the new changes to socket.io.

do you solve your issue ?

ghost commented 3 years ago

also getting this issue, it appears to be related to the new changes to socket.io.

do you solve your issue ?

sort of: i added cors to the socketio section of laravel-echo-server.json "socketio": { "cors": { "origin": true, "methods": ["GET", "POST"], "credentials": true } } and then on the laravel-echo client options i added withCredentials:true

it seemed to stop the error, however, its not upgrading from polling to websocket.

FlorianB385 commented 3 years ago

can you post your complete laravel-echo-server.json?

hgaoping commented 3 years ago

Just reinstall it, it may be a software package bug