for some reason we can encounter ws that have no users

This commit is contained in:
HF 2021-07-10 20:29:27 +02:00
parent fbc564f588
commit 1ffd8b740c

View File

@ -142,7 +142,7 @@ class SocketServer {
) => {
const text = JSON.stringify([name, message, country, channelId, id]);
this.wss.clients.forEach((ws) => {
if (ws.readyState === WebSocket.OPEN) {
if (ws.readyState === WebSocket.OPEN && ws.user) {
if (chatProvider.userHasChannelAccess(ws.user, channelId)) {
ws.send(text);
}