我按照提供的文档,似乎服务器没有接受连接:
(failed)
net::ERR_CONNECTION_CLOSED
应用 laravel-echo-server start 命令后,服务器似乎已启动并运行:
L A R A V E L E C H O S E R V E R
version 1.3.6
⚠ Starting server in DEV mode...
✔ Running at localhost on port 6001
✔ Channels are ready.
✔ Listening for http events...
✔ Listening for redis events...
Server ready!
bootstrap.js:
import Echo from 'laravel-echo'
window.io = require('socket.io-client');
window.Echo = new Echo({
broadcaster: 'socket.io',
host: window.location.hostname + ':6001',
});
.ENV:
CACHE_DRIVER=file
SESSION_DRIVER=file
QUEUE_DRIVER=redis
REDIS_HOST=localhost
REDIS_PASSWORD=null
REDIS_PORT=6379
laravel回波-server.json
{
"authHost": "http://dialfy.local",
"authEndpoint": "/broadcasting/auth",
"clients": [
{
"appId": "dd4d563e7e81f442",
"key": "1627b6fd226c7f3c866ca209f78779b6"
}
],
"database": "redis",
"databaseConfig": {
"redis": {},
"sqlite": {
"databasePath": "/database/laravel-echo-server.sqlite"
}
},
"devMode": true,
"host": null,
"port": "6001",
"protocol": "http",
"socketio": {},
"sslCertPath": "",
"sslKeyPath": "",
"sslCertChainPath": "",
"sslPassphrase": "",
"apiOriginAllow": {
"allowCors": false,
"allowOrigin": "",
"allowMethods": "",
"allowHeaders": ""
}
}
关于问题可能是什么,或者我可以开始寻找的任何想法?我想这是一个配置问题,但我似乎无法将其放在上面。
答案 0 :(得分:0)
对于遇到类似问题的其他人:原因是因为我的应用程序在本地运行https,而我没有配置laravel-echo-server来做同样的事情。