Answer the question
In order to leave comments, you need to log in
How to run laravel echo server ( +redis ) with external ip access (alias OpenServer)?
Windows has Open Server and Redis
installed . Through Open Server in aliases:
1) Redirection from external ip to the final domain (vizitka/).
2) Redirection from local ip (192.168.0.102) to the final domain (vizitka/).
The site has a chat on websocket ( socket.io) .
When connecting to the site from the local ip , laravel echo authorization works fine. But if you connect from an external ip , then the site opens, but websocket connection requests are not executed:
http://внешнийIP:6001/socket.io/?EIO=3&transport=polling&t=MKaHXCl 0 ()
REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379
{
"authHost": "http://vizitka/",
"authEndpoint": "/broadcasting/auth",
"clients": [
{
"appId": "APP_ID",
"key": "e0702d5258f6bd18b91d52f7a37442f2"
}
],
"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": ""
}
}
window.Echo = new Echo({
broadcaster: 'socket.io',
host: window.location.hostname + ':6001',
auth: {
headers: {
Authorization: 'Bearer ' + localStorage.getItem('token')
},
},
});
window.Echo.private('room.' + this.user_id)
.listen('PrivateChat', ({data}) => {
...
})
✔ Running at http://внешнийIp/ on port 6001
✔ Channels are ready.
✔ Listening for http events...
events.js:183
throw er; // Unhandled 'error' event
^
Error: getaddrinfo ENOTFOUND http://внешнийIp/
at errnoException (dns.js:50:10)
at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:92:26)
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question