Не работает бродкастер на продакшене
На продакшене отваливается бродкастер laravel-echo-server, причем на локальной машине все работает прекрасно. Прод пока на http. Авторизация проходит успешно но при попытке что-то написать в чат выдает ошибку в консоль там где запущена команда laravel-echo-server start в моем случае это контенер node.js
(node:34) UnhandledPromiseRejectionWarning: TypeError: Cannot convert undefined or null to object
at /usr/local/lib/node_modules/laravel-echo-server/dist/channels/presence-channel.js:78:21
at processTicksAndRejections (internal/process/task_queues.js:97:5)
(node:34) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 8)
laravel-echo-server.json
{
"authHost": "http://nginx:8888",
"authEndpoint": "/broadcasting/auth",
"clients": [
{
"appId": "",
"key": ""
}
],
"database": "redis",
"databaseConfig": {
"redis": {
"host": "redis",
"port": "6379"
},
"sqlite": {
"databasePath": "/database/laravel-echo-server.sqlite"
}
},
"devMode": true,
"host": null,
"port": "6002",
"protocol": "http",
"socketio": {},
"secureOptions": 67108864,
"sslCertPath": "",
"sslKeyPath": "",
"sslCertChainPath": "",
"sslPassphrase": "",
"subscribers": {
"http": true,
"redis": true
},
"apiOriginAllow": {
"allowCors": true,
"allowOrigin": "http://nginx:8888",
"allowMethods": "GET, POST",
"allowHeaders": "Origin, Content-Type, X-Auth-Token, X-Requested-With, Accept, Authorization, X-CSRF-TOKEN, X-Socket-Id"
}
}
Канал
Broadcast::channel('chat.{chat_id}', function ($user, $chat_id) {
if ($user->chats->where('id', $chat_id)->count() != 0) {
return $user;
}
return false;
});
во vue темплейте ни один из каналов не работает
window.Echo.join('chat.' + this.chat_id)
.here(users => {
this.activeUsers = users
})
.joining(user => {
this.activeUsers.push(user)
})
.leaving(user => {
this.activeUsers.splice(this.activeUsers.indexOf(user), 1)
})
.listen('PrivateChatEvent', ({data}) => {
if ( data.user.id === this.currentUser.id) {
this.changeMessage(data)
} else {
data.class = 'ltr';
this.messages.push(data);
setTimeout(() => { this.scrollChatContent() }, 10);
}
});