Skip to content

Stomp node: error sending payload as XML #1068

@martin-doyle

Description

@martin-doyle

Which node are you reporting an issue on?

Stomp

What are the steps to reproduce?

  • Format payload as XML
  • Send payload via stomp out node

What happens?

  • Payload as JSON with XML inside

What do you expect to happen?

  • Payload as XML

Please tell us about your environment:

  • Node-RED version: 3
  • node.js version: 18
  • npm version: 10.7
  • Platform/OS: Linux, Windows
  • Browser: Chrome, Edge

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();
                }
            });

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions