node -v
1.3.1 Where is install
C:\Users\QuocVo\node_modules\laravel-echo
1.3.2 Where is config file
Path: If you are staging on C:\Users\QuocVo in CLI of step 1.4 and you run: npx laravel-echo-server init
You will have C:\Users\QuocVo\laravel-echo-server.json
{
"authHost": "http://laravel82.local",
"authEndpoint": "/broadcasting/auth",
"clients": [
{
"appId": "APP_ID",
"key": "5f7b36ba244b2f003ff1f91a7181d34d"
}
],
"database": "redis",
"databaseConfig": {
"redis": {
"port": 63799,
"host": "host.docker.internal"
},
"sqlite": {
"databasePath": "/database/laravel-echo-server.sqlite"
}
},
"devMode": true,
"host": null,
"port": "6001",
"protocol": "http",
"socketio": {},
"secureOptions": 67108864,
"sslCertPath": "",
"sslKeyPath": "",
"sslCertChainPath": "",
"sslPassphrase": "",
"subscribers": {
"http": true,
"redis": true
},
"apiOriginAllow": {
"allowCors": false,
"allowOrigin": "",
"allowMethods": "",
"allowHeaders": ""
}
}
Window:
$ npx laravel-echo-server init
? Do you want to run this server in development mode? Yes
? Which port would you like to serve from? 6001
? Which database would you like to use to store presence channel members? redis
? Enter the host of your Laravel authentication server. http://laravel82.local
? Will you be serving on http or https? http
? Do you want to generate a client ID/Key for HTTP API? No
? Do you want to setup cross domain access to the API? No
? What do you want this config to be saved as? laravel-echo-server.json
Configuration file saved. Run laravel-echo-server start to run server.
Linux
$ laravel-echo-server init
Window:
$ npx laravel-echo-server start
L A R A V E L E C H O S E R V E R
version 1.6.3
⚠ Starting server in DEV mode...
✔ Running at localhost on port 6001
✔ Channels are ready.
✔ Listening for http events...
✔ Listening for redis events...
Linx: $ laravel-echo-server start
2.1 Config path of Laravel-echo-server
You're staying on D:\YourProject && run: $ npx laravel-echo-server init you will be generated D:\YourProject\laravel-echo-server.json
2.2 Change Config redis
{
"authHost": "http://laravel82.local",
"authEndpoint": "/broadcasting/auth",
"clients": [],
"database": "redis",
"databaseConfig": {
"redis": {},
"sqlite": {
"databasePath": "/database/laravel-echo-server.sqlite"
}
},
"devMode": true,
"host": null,
"port": "6001",
"protocol": "http",
...
}
3.1 Rebuild client
$ laravel-echo-server client:add APP_ID
3.2 Client will built in You will have C:\Users\QuocVo\laravel-echo-server.json
{
"authHost": "http://laravel82.local",
"authEndpoint": "/broadcasting/auth",
"clients": [
{
"appId": "APP_ID",
"key": "5f7b36ba244b2f003ff1f91a7181d34d"
}
],
"database": "redis",
...
}
4.1 Bearer
CURL
curl --location 'http://localhost:6001/apps/APP_ID/status' \
--header 'Authorization: Bearer 5f7b36ba244b2f003ff1f91a7181d34d'
4.2 API
GET: http://localhost:6001/apps/APP_ID/status?auth_key=5f7b36ba244b2f003ff1f91a7181d34d
Response
{
"subscription_count": 0,
"uptime": 679.0968037,
"memory_usage": {
"rss": 62574592,
"heapTotal": 22110208,
"heapUsed": 19980288,
"external": 2440128,
"arrayBuffers": 50659
}
}
5.1 Status Get total number of clients, uptime of the server, and memory usage.
Request GET: http://localhost:6001/apps/APP_ID/status?auth_key=5f7b36ba244b2f003ff1f91a7181d34d
Response
{
"subscription_count":0,
"uptime":1924.6354583,
"memory_usage {
"rss":62644224,"heapTotal":22110208,
"heapUsed":20051312,"external":2440128,
"arrayBuffers":50659
}
}
5.2 Channels List of all channels.
Request GET: http://localhost:6001/apps/APP_ID/channels?auth_key=5f7b36ba244b2f003ff1f91a7181d34d
Response
{"channels":{}}