Reputation: 55
I am using redis and laravel-echo-server for broadcasting.
When i init Echo in my bootstrap.js like:
import Echo from 'laravel-echo';
window.io = require('socket.io-client');
if (typeof io !== 'undefined') {
window.Echo = new Echo({
broadcaster: 'socket.io',
host: window.location.hostname + ':6001',
})
}
I get error in console:
app.js:12063 POST http://app.blog:6001/socket.io/?EIO=4&transport=polling&t=NMmu7VC 400 (Bad Request)
When i click on it it shows:
{
code: 2
message: "Bad handshake method"
}
laravel-echo-server.json
{
"appKey": "base64:HfA91lrA3RDCklIxjodAFREue6lmhA1oslXYMVTceR8=",
"authHost": "app.blog",
"authEndpoint": "/broadcasting/auth",
"clients": [],
"database": "redis",
"databaseConfig": {
"redis": {},
"sqlite": {
"databasePath": "/database/laravel-echo-server.sqlite"
}
},
"devMode": true,
"host": null,
"port": "6001",
"protocol": "http",
"socketio": {},
"secureOptions": 67108864,
"sslCertPath": "",
"sslKeyPath": "",
"sslCertChainPath": "",
"sslPassphrase": "",
"subscribers": {
"http": true,
"redis": true
},
"apiOriginAllow": {
"allowCors": false,
"allowOrigin": "",
"allowMethods": "",
"allowHeaders": ""
}
}
Event broadcasting is working despite the error but i want to use broadcast notifications
Upvotes: 2
Views: 1687
Reputation: 2855
Not sure the exact reason but downgrading to v2.3.0 the solution for that situation. found the relevant issue and the solution here
I think it's not related to laravel but socket io
You can add this issue to the GitHub repository
Upvotes: 2