This repository was archived by the owner on Oct 31, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
WebSockets with pro cli and laravel echo server
chris edited this page Jan 19, 2018
·
1 revision
pro-cli provides the ability to use WebSockets in combination with laravel-echo-server. See the Laravel documentation for further info.
- web
- redis
- echo
By default, Laravel projects (project init test --type=laravel) come with the ./conf/echo/laravel-echo-server.json to allow starting the WebSocket container. You still have to initialise laravel-echo-server by using the appropriate command:
project echo init{
"authHost": "http://web",
"authEndpoint": "/broadcasting/auth",
"clients": [
{
"appId": "APP_ID",
"key": "APP_KEY"
}
],
"database": "redis",
"databaseConfig": {
"redis": {
"port": "6379",
"host": "redis"
},
"sqlite": {
"databasePath": "/database/laravel-echo-server.sqlite"
}
},
"devMode": true,
"host": null,
"port": "6001",
"protocol": "http",
"socketio": {},
"sslCertPath": "",
"sslKeyPath": "",
"sslCertChainPath": "",
"sslPassphrase": "",
"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"
}
}See the Laravel documentation.
In your ./src/.env provide the following variables or according to your environment configuration:
BROADCAST_DRIVER=redis
Don't forget to require the redis driver
project composer require predis/predisTo push the events, you need to run a queue listener.
project logs -f echo web