Debug shows JSON but MQTT doesn't trigger

Hey,

I've had a few MQTTs IN and they work great.

But now, I'm sending via a online PHP Site a MQTT Message to one of my nodes.
When I'm Sending an String for example "start" it works perfectly.

But when I'm sending a JSON to the MQTT IN it doesn't trigger but shows in the DEBUG? What I'm confusing here?

image

The JSON which I encoded with PHP is:

"{"subscription":{"id":"c1389533-d679-1334-9065-a4d78855abdb","status":"enabled","type":"channel.follow","version":"1","condition":{"broadcaster_user_id":"90205343"},"transport":{"method":"webhook","callback":"null"},"created_at":"2022-05-06T12:59:11.3793627Z","cost":0},"event":{"user_id":"44444","user_login":"testFromUser","user_name":"testFromUser","broadcaster_user_id":"44444","broadcaster_user_login":"90205343","broadcaster_user_name":"testBroadcaster","followed_at":"2022-05-06T12:59:11.3793627Z"}}"

Thanks for your help

What do you mean by "It doesn't trigger"?

The snapshot of your flow only shows the mqtt in and debug nodes.
What else are you expecting to happen?

1 Like

I subscribed to this topic "datafromweb/light" with a microcontroller.

I got the message, when the webserver sends a string (over MQTT to this topic) but with the JSON, the MQTT is not recieved. So I meant "trigger" the MQTT message.

Greetings

The json you posted is not valid.
the outer quotes are fine but the inner one's should be escaped with \ or replace outer with single quotes.

As it is not a valid json string the php script is probably not sending it.

1 Like

Yes perhaps the quotes confuse whichever device sends the Mqtt message. You could try single quotes for the outermost " and ".
(I can't test it, not at my computer).

1 Like

Thanks for the replys.

Nodred Debug recievs the JSON. Then I'm trying with PHP to change the JSON...

image

I'm totally confused. There's a microcontroller, a web server and some device running Node-red.
PHP is running somewhere too

Your message is received in Node-red, but it is not received wherever you have PHP.

I don't see how an mqtt-in node in Node-red is supposed to make the message available to PHP.

Thanks 4 your question :slight_smile: So got a new clew what I can test.

I tried now with nodejs to subscribe to this topic and I can recieve it. So Node Red is not the problem :slight_smile:

The JSON is probably to large or whatever... thanks again for your time and your thoughts.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.