boisterouslobster
boisterouslobster

Reputation: 1293

SocketIO + Redis Connection Closed

I followed the documentation provided, and it seems that the server isn't accepting the connection:

(failed)
net::ERR_CONNECTION_CLOSED

Server appears to be up and running after applying the laravel-echo-server start command:

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-echo-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": ""
    }
}

Any idea on what the issue may be, or where I could start looking? I imagine it is a configuration issue, but I can't seem to put my finger on it.

Upvotes: 0

Views: 419

Answers (1)

boisterouslobster
boisterouslobster

Reputation: 1293

For anyone else who runs into a similar problem: the reason was because my app was running on https locally, and I did not configure laravel-echo-server to do the same.

Upvotes: 1

Related Questions