diff --git a/backend/src/ws.ts b/backend/src/ws.ts index 2a14ad5..ecdf647 100644 --- a/backend/src/ws.ts +++ b/backend/src/ws.ts @@ -80,9 +80,11 @@ export function setupWebSocket(app: FastifyInstance) { broadcast(ids.filter(id => id !== userId), { type: 'user_online', payload: { userId, online: true } }); } - socket.on('message', async (raw: any) => { + socket.on('message', async (raw: any, isBinary: boolean) => { try { - const { type, payload } = JSON.parse(raw.toString()); + const str = isBinary ? raw.toString('utf8') : raw.toString(); + console.log('[WS] received:', str.substring(0, 200)); + const { type, payload } = JSON.parse(str); if (type === 'typing') { const members = await getChatMemberIds(payload.chatId);