debug: log WS messages to diagnose send issue

This commit is contained in:
Ai
2026-05-22 13:26:19 +03:00
parent 210d4302e7
commit 71b961ac2b

View File

@@ -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);