node-red / node-red-nodes

Extra nodes for Node-RED
Other
964 stars 592 forks source link

Stomp node: error sending payload as XML #1068

Open martin-doyle opened 1 month ago

martin-doyle commented 1 month ago

Which node are you reporting an issue on?

Stomp

What are the steps to reproduce?

What happens?

What do you expect to happen?

Please tell us about your environment:

When started

commit 0d7f0cb STOMP refactor in accordance with MQTT (shared connection using confi…

Before

    node.on("input", function(msg) {
            node.client.publish(node.topic || msg.topic, msg.payload, msg.headers);
        });

After

            node.on("input", function(msg, send, done) {
                if (node.topic && msg.payload) {
                    try {
                        msg.payload = JSON.stringify(msg.payload);
                    } catch {
                        msg.payload = `${msg.payload}`;
                    }
                    node.serverConnection.publish(node.topic, msg.payload, msg.headers || {});
                    done();
                }
            });