debug: log WS messages to diagnose send issue
This commit is contained in:
@@ -80,9 +80,11 @@ export function setupWebSocket(app: FastifyInstance) {
|
|||||||
broadcast(ids.filter(id => id !== userId), { type: 'user_online', payload: { userId, online: true } });
|
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 {
|
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') {
|
if (type === 'typing') {
|
||||||
const members = await getChatMemberIds(payload.chatId);
|
const members = await getChatMemberIds(payload.chatId);
|
||||||
|
|||||||
Reference in New Issue
Block a user