net::ERR_CONNECTION_TIMED_OUT 错误 laravel 回显与 redis 驱动程序
net::ERR_CONNECTION_TIMED_OUT error in laravel echo with redis driver
我正在使用 laravel-echo 和 redis 驱动程序来广播通知。它在我的本地系统上完美运行。但是在我的服务器上,出现 ERR_CONNECTION_TIMED_OUT
错误。浏览器控制台显示 http://ex.example.com:6001/socket.io/socket.io.js net::ERR_CONNECTION_TIMED_OUT
。
我对socket和redis一无所知。所以我只是按照 laravel official doc and laravel-echo-server. and made just one change from here. But with help of that change, I'm able to let execute remaining js script. Issue of socket.io.js is still unsolved (Also in github).
的指示进行操作
这是我遵循的步骤。
- 关注Laravel Official Doc
- 安装Redis-Server
- 安装laravel-echo-server
- 在我的项目中安装socket.io-clent
js
import Echo from "laravel-echo"
window.io = require('socket.io-client'); //suggested in github issue
window.Echo = new Echo({
broadcaster: 'socket.io',
host: window.location.hostname + ':6001'
});
laravel-echo-server.json
{
"authHost": "http://ex.example.com",
"authEndpoint": "/broadcasting/auth",
"clients": [
{
"appId": "edbf10287972d875",
"key": "96403c9f93e1a2d86185e2d21aa0fae1"
}
],
"database": "redis",
"databaseConfig": {
"redis": {},
"sqlite": {
"databasePath": "/database/laravel-echo-server.sqlite"
}
},
"devMode": true,
"host": null,
"port": "6001",
"protocol": "http",
"socketio": {},
"sslCertPath": "",
"sslKeyPath": ""
}
如果有人知道解决方案,将不胜感激。
这听起来很简单,但是您检查过服务器上的防火墙设置了吗?
编辑:感谢@AkshayVaghasiya 分享正确设置防火墙的说明 [read here]。
我正在使用 laravel-echo 和 redis 驱动程序来广播通知。它在我的本地系统上完美运行。但是在我的服务器上,出现 ERR_CONNECTION_TIMED_OUT
错误。浏览器控制台显示 http://ex.example.com:6001/socket.io/socket.io.js net::ERR_CONNECTION_TIMED_OUT
。
我对socket和redis一无所知。所以我只是按照 laravel official doc and laravel-echo-server. and made just one change from here. But with help of that change, I'm able to let execute remaining js script. Issue of socket.io.js is still unsolved (Also in github).
的指示进行操作这是我遵循的步骤。
- 关注Laravel Official Doc
- 安装Redis-Server
- 安装laravel-echo-server
- 在我的项目中安装socket.io-clent
js
import Echo from "laravel-echo"
window.io = require('socket.io-client'); //suggested in github issue
window.Echo = new Echo({
broadcaster: 'socket.io',
host: window.location.hostname + ':6001'
});
laravel-echo-server.json
{
"authHost": "http://ex.example.com",
"authEndpoint": "/broadcasting/auth",
"clients": [
{
"appId": "edbf10287972d875",
"key": "96403c9f93e1a2d86185e2d21aa0fae1"
}
],
"database": "redis",
"databaseConfig": {
"redis": {},
"sqlite": {
"databasePath": "/database/laravel-echo-server.sqlite"
}
},
"devMode": true,
"host": null,
"port": "6001",
"protocol": "http",
"socketio": {},
"sslCertPath": "",
"sslKeyPath": ""
}
如果有人知道解决方案,将不胜感激。
这听起来很简单,但是您检查过服务器上的防火墙设置了吗?
编辑:感谢@AkshayVaghasiya 分享正确设置防火墙的说明 [read here]。