我的整个laravel-echo-server.json如下所示
{
"authHost": "https://example.com",
"authEndpoint": "/broadcasting/auth",
"clients": [
{
"appId": "created using command laravel-echo-server init",
"key": "created using command laravel-echo-server init"
}
],
"database": "redis",
"databaseConfig": {
"redis": {
"host": "example.com ip address",
"port": 6379
},
"sqlite": {
"databasePath": "/database/laravel-echo-server.sqlite"
}
},
"devMode": true,
"host": null,
"port": "6001",
"protocol": "https",
"socketio": {},
"sslCertPath": "/home/username/ssl/certs/XXX..XX.crt",
"sslKeyPath": "/home/username/ssl/keys/XXX...XX.key",
"sslCertChainPath": "",
"sslPassphrase": "",
"subscribers": {
"http": true,
"redis": true
},
"apiOriginAllow": {
"allowCors": false,
"allowOrigin": "",
"allowMethods": "",
"allowHeaders": ""
}
}
“ public / js / app.js”中的代码段:
window.Echo = new __WEBPACK_IMPORTED_MODULE_0_laravel_echo__["a" /* default */]({
broadcaster: 'socket.io',
host: window.location.hostname + ':6001'
});
laravel-echo-server启动和redis-cli监视器也可以正常工作。
但是在浏览器(检查元素)中,http://example.com:6001/socket.io/?EIO=3&transport=polling&t=MZ29tzO不返回任何响应。
服务器:Cent OS 7
答案 0 :(得分:0)
请确保:
npm install --save socket.io-client
和npm install --save laravel-echo
我一直关注this instructions and customized some configurations。看看my laravel-echo-server.json working on LOCAL enviroment和this laravel-echo-server.json working on PRODUCTION enviroment,它应该可以为您提供见识。