From 939225a610eb3a5579d055ba9cf59d3d6846fe3b Mon Sep 17 00:00:00 2001 From: Nuwan Date: Sun, 1 Feb 2026 22:03:28 +0530 Subject: [PATCH] fix: correct WebSocket callback signature for chat messages The WebSocket onmessage handler passes (message, payload) to callbacks, where payload contains the actual message data. Updated handleChatMessage to use the second parameter (payload) instead of first (message). This fixes: Multi-user chat messages now properly received and displayed Co-Authored-By: Claude Sonnet 4.5 --- jam-ui/src/components/client/JKSessionScreen.js | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/jam-ui/src/components/client/JKSessionScreen.js b/jam-ui/src/components/client/JKSessionScreen.js index 73c5891b7..f5f85506d 100644 --- a/jam-ui/src/components/client/JKSessionScreen.js +++ b/jam-ui/src/components/client/JKSessionScreen.js @@ -540,15 +540,17 @@ const JKSessionScreen = () => { //@refreshCurrentSession(true); // Chat message handler - receives messages from WebSocket and dispatches to Redux - const handleChatMessage = (data) => { + // Callback signature: (fullMessage, payload) where payload contains the chat_message data + const handleChatMessage = (fullMessage, payload) => { // Transform Protocol Buffer format to Redux format + // payload contains: {sender_name, sender_id, msg, msg_id, created_at, channel, ...} const message = { - id: data.msg_id, - senderId: data.sender_id, - senderName: data.sender_name, - message: data.msg, - createdAt: data.created_at, - channel: 'session', + id: payload.msg_id, + senderId: payload.sender_id, + senderName: payload.sender_name, + message: payload.msg, + createdAt: payload.created_at, + channel: payload.channel || 'session', sessionId: currentSession.id }; dispatch(addMessageFromWebSocket(message));