When I deploy laravel-echo-server
locally it works just fine, but it's a different case when I host my app. I've researched multiple articles online but I can't resolve the problem, because they deploy diffently from how i deploy.
Here's how I deploy locally
:
1) I create a file and name it server.js
2) Add the follow code.
require('dotenv').config();
const env = process.env;
require('laravel-echo-server').run({
authHost: env.APP_URL,
devMode: env.APP_DEBUG,
database: "redis",
databaseConfig: {
redis: {
host: env.REDIS_HOST,
port: env.REDIS_PORT,
}
}
});
3) Run npm i dotenv laravel-echo-server
4) In my .env
file, I add:
APP_DEBUG=true
APP_URL=http://localhost
REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379
BROADCAST_DRIVER=redis
CACHE_DRIVER=file
QUEUE_CONNECTION=sync
SESSION_DRIVER=file
SESSION_LIFETIME=1800
5) Then run node server.js
Locally it works perfectly well.
Then on cpanel
First I run:
1) npm i dotenv laravel-echo-server
2) In my .env
file I edit my database configs and set by APP_DEBUG
to false.
3) Next I run node server.js
It runs but no connections.