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...
Server ready!
[2025-08-17T14:12:27.093Z] - Preparing authentication request to: https://noname.test
[2025-08-17T14:12:27.094Z] - Sending auth request to: https://noname.test/broadcasting/auth
[2025-08-17T14:12:27.774Z] - c9BpddPvbwjaVey9AAAA authenticated for: presence-chatroom.1
Unable to join channel. Member data for presence channel missing
[2025-08-17T14:12:27.790Z] - c9BpddPvbwjaVey9AAAA joined channel: presence-chatroom.1
[2025-08-17T14:12:28.652Z] - Preparing authentication request to: https://noname.test
[2025-08-17T14:12:28.652Z] - Sending auth request to: https://noname.test/broadcasting/auth
[2025-08-17T14:12:28.732Z] - c9BpddPvbwjaVey9AAAA authenticated for: private-chatter.3
[2025-08-17T14:12:28.733Z] - c9BpddPvbwjaVey9AAAA joined channel: private-chatter.3
Broadcast::channel('chatroom.{id}', function ($user, $id) {
Log::error('Incoming broadcast auth');
return User::select([
'id',
'username',
'group_id',
'image',
'chatroom_id',
'chat_status_id',
'is_lifetime',
'is_donor',
'icon'
])
->with(['chatStatus:id,color', 'chatroom:id,name', 'group:id,color,effect,icon'])
->find($user->id);
});
Broadcast::channel('chatter.{id}', function ($user, $id) {
Log::error('Incoming broadcast auth');
return $user->id == $id;
});
APP_DEBUG=true
APP_URL=https://noname.test
VITE_ECHO_ADDRESS=https://noname.test
LOG_CHANNEL=daily
BROADCAST_DRIVER=redis
CACHE_DRIVER=redis
SESSION_DRIVER=redis
SESSION_CONNECTION=session
SESSION_LIFETIME=120
SESSION_SECURE_COOKIE=true
QUEUE_CONNECTION=redis
REDIS_HOST=/var/run/redis/redis.sock
REDIS_PASSWORD=null
REDIS_PREFIX=
REDIS_PORT=-1
REDIS_SCHEME=unix
{
"authHost": "https://noname.test",
"authEndpoint": "/broadcasting/auth",
"clients": [
{
"appId": "appId",
"key": "key"
}
],
"database": "redis",
"databaseConfig": {
"redis": {
"path": "/var/run/redis/redis.sock",
"db": "0",
"password": null
},
"sqlite": {
"databasePath": "/database/laravel-echo-server.sqlite"
}
},
"devMode": true,
"host": null,
"port": "6001",
"protocol": "http",
"socketio": {},
"secureOptions": 67108864,
"sslCertPath": "",
"sslKeyPath": "",
"sslCertChainPath": "",
"sslPassphrase": "",
"apiOriginAllow": {
"allowCors": false,
"allowOrigin": "",
"allowMethods": "",
"allowHeaders": ""
}
}
import Echo from 'laravel-echo';
import client from 'socket.io-client';
window.io = client;
window.Echo = new Echo({
broadcaster: 'socket.io',
host: import.meta.env.VITE_ECHO_ADDRESS,
path: '/ws/socket.io',
forceTLS: true,
withCredentials: true,
transports: ['websocket'],
enabledTransports: ['wss'],
});
location /ws/{
proxy_pass http://127.0.0.1:6001/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header X-Forwarded-For $remote_addr;
}
import Echo from 'laravel-echo';
import client from 'socket.io-client';
window.io = client;
window.Echo = new Echo({
broadcaster: 'socket.io',
host: import.meta.env.VITE_ECHO_ADDRESS,
path: '/ws/socket.io',
forceTLS: true,
withCredentials: true,
transports: ['websocket'],
enabledTransports: ['wss'],
});
...
// Channel handler module
const channelHandler = {
setupRoom(id, context) {
if (context.channel) {
window.Echo.leave(`chatroom.${context.state.chat.room}`);
}
context.channel = window.Echo.join(`chatroom.${id}`);
this.setupListeners(context);
},
setupListeners(context) {
if (!context.channel) return;
context.channel
.here((users) => {
context.users = new Map(users.map((user) => [user.id, user]));
})
.joining((user) => {
context.users.set(user.id, user);
})
.leaving((user) => {
context.users.delete(user.id);
})
.listen('.new.message', (e) => {
if (!context.state.chat.activeTab.startsWith('room')) return;
const message = context.processMessageCanMod(e.message);
context.messages.push(message);
})
.listen('.new.ping', (e) => {
context.handlePing('room', e.ping.id);
})
.listen('.delete.message', (e) => {
if (context.state.chat.target > 0 || context.state.chat.bot > 0) return;
let index = context.messages.findIndex((msg) => msg.id === e.message.id);
if (index !== -1) context.messages.splice(index, 1);
})
.listenForWhisper('typing', (e) => {
if (context.state.chat.target > 0 || context.state.chat.bot > 0) return;
const username = e.username;
clearTimeout(context.activePeer.get(username));
const messageTimeout = setTimeout(() => context.activePeer.delete(username), 15000);
context.activePeer.set(username, messageTimeout);
});
context.channel.error((error) => {
console.error('Socket error:', error);
context.state.ui.error = 'Connection lost. Trying to reconnect...';
setTimeout(() => {
this.setupRoom(context.state.chat.room, context);
}, 5000);
});
},
};
...