Tuesday, August 30, 2022

[SOLVED] Laravel echo server won't start

Issue

Laravel echo server keeps returning failed status on my server

Code

laravel-echo-server.json

{
    "authHost": "http://example.com",
    "authEndpoint": "/broadcasting/auth",
    "clients": [
        {
            "appId": "311dr094tf98745ce",
            "key": "fa43bffb3rth63f5ac9c386916ae28e6"
        }
    ],
    "database": "redis",
    "databaseConfig": {
        "redis": {},
        "sqlite": {
            "databasePath": "/database/laravel-echo-server.sqlite"
        }
    },
    "devMode": false,
    "host": null,
    "port": "6001",
    "protocol": "http",
    "socketio": {},
    "secureOptions": 67108864,
    "sslCertPath": "",
    "sslKeyPath": "",
    "sslCertChainPath": "",
    "sslPassphrase": "",
    "subscribers": {
        "http": true,
        "redis": true
    },
    "apiOriginAllow": {
        "allowCors": true,
        "allowOrigin": "http://localhost:80",
        "allowMethods": "GET, POST",
        "allowHeaders": "Origin, Content-Type, X-Auth-Token, X-Requested-With, Accept, Authorization, X-CSRF-TOKEN, X-Socket-Id"
    }
}

echo-pm2.json

{
  "name": "echo",
  "script": "laravel-echo-server.json",
  "args": "start"
}

then i run pm2 start echo-pm2.json and status is online but when i visit my web page i keep getting

GET https://www.example.com:6001/socket.io/?EIO=3&transport=polling&t=NA2SNHk net::ERR_TIMED_OUT

Any idea?


Solution

Solved

The problem was my url was set to https (GET https://www.example.com) while my actual address is running on http (GET http://www.example.com)

so that extra S... :)



Answered By - mafortis
Answer Checked By - David Marino (WPSolving Volunteer)