fix: prevent double serialization of websocket text messages. (#6182)

This commit is contained in:
Praveen kumar
2025-12-22 14:57:32 +05:30
committed by Sid
parent 70178f60b3
commit e3ab415f24

View File

@@ -150,8 +150,11 @@ class WsClient {
messageToSend = message;
}
// If messageToSend is a string, send it raw. If it is an object, stringify it.
const payload = typeof messageToSend === 'string' ? messageToSend : JSON.stringify(messageToSend);
// Send the message
connectionMeta.connection.send(JSON.stringify(messageToSend), (error) => {
connectionMeta.connection.send(payload, (error) => {
if (error) {
this.eventCallback('main:ws:error', requestId, collectionUid, { error });
} else {