# Websockets passing all msg properties as payload instead of discrete

**URL:** <https://discourse.nodered.org/t/websockets-passing-all-msg-properties-as-payload-instead-of-discrete/65369>\
**Category:** General\
**Created:** [20 July 2022 14:53 UTC](https://discourse.nodered.org/t/websockets-passing-all-msg-properties-as-payload-instead-of-discrete/65369 "2022-07-20T14:53:04Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rgrove](https://avatars.discourse-cdn.com/v4/letter/r/5f8ce5/32.png) [@Rgrove](https://discourse.nodered.org/u/Rgrove)\
**Post date:** [20 July 2022 14:53 UTC](https://discourse.nodered.org/t/websockets-passing-all-msg-properties-as-payload-instead-of-discrete/65369/1 "2022-07-20T14:53:04Z")

</div>

Good morning!

Edited for less words...

I have two RPi's.  
Flow set up on Site A, then copied to Site B, with some unique params changed (site ID, temp sensors serial's).

Both send data via websockets to a master NodeRed system that sorts and processes the data for a dashboard.

Site A sends msg.topic and master site receives it exactly as sent.  
Site B sends msg.topic, and master receives it with msg.topic property buried in the payload.

Somewhere between the websocket input at site B and websocket output at Master site, all msg.properties are encapsulated into the payload. So msg.topic doesn't exist when received by Master site websocket.

A debug node on Site B shows all message properties reaching the outbound websocket as expected.  
A debug node on the master site receiuve websocket shows all properties bundled into payload.

Better screenshot, my highlighter obscured the colors of the original:  
Bottom debug is the working unit, showing "topic" in blue as a property.  
Top debug is the not working unit, showing "topic" as payload data.

Both units send uptime the same (Site A sends as a topic, site B sends as payload), I just couldn't find debug nodes of those next to each other for a better screenshot.

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/f/1/f16db2c4aa6cc4b8fdf5f932fb22444df234fff3.png)

---

<div class="post-metadata">

**Author:** ![HaroldPetersInskipp](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/haroldpetersinskipp/32/42319_2.png) [@HaroldPetersInskipp](https://discourse.nodered.org/u/HaroldPetersInskipp)\
**Post date:** [20 July 2022 15:02 UTC](https://discourse.nodered.org/t/websockets-passing-all-msg-properties-as-payload-instead-of-discrete/65369/2 "2022-07-20T15:02:26Z")

</div>

Looks like a JSON string, and sounds like you want it to be converted to an object.

You can use the built in `JSON` node.

---

<div class="post-metadata">

**Author:** ![Rgrove](https://avatars.discourse-cdn.com/v4/letter/r/5f8ce5/32.png) [@Rgrove](https://discourse.nodered.org/u/Rgrove)\
**Post date:** [20 July 2022 15:07 UTC](https://discourse.nodered.org/t/websockets-passing-all-msg-properties-as-payload-instead-of-discrete/65369/3 "2022-07-20T15:07:05Z")

</div>

I'm not sure that's the issue. Wouldn't that be required on both units then?  
It works fine from one, but not the other.

Both separate sites use the same copied flow to generate the message and send over websockets. One produces expected results, the other does not.

---

<div class="post-metadata">

**Author:** ![HaroldPetersInskipp](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/haroldpetersinskipp/32/42319_2.png) [@HaroldPetersInskipp](https://discourse.nodered.org/u/HaroldPetersInskipp)\
**Post date:** [20 July 2022 15:21 UTC](https://discourse.nodered.org/t/websockets-passing-all-msg-properties-as-payload-instead-of-discrete/65369/4 "2022-07-20T15:21:50Z")

</div>

Post both full flows here, then I can compare them.

---

<div class="post-metadata">

**Author:** ![Rgrove](https://avatars.discourse-cdn.com/v4/letter/r/5f8ce5/32.png) [@Rgrove](https://discourse.nodered.org/u/Rgrove)\
**Post date:** [20 July 2022 15:26 UTC](https://discourse.nodered.org/t/websockets-passing-all-msg-properties-as-payload-instead-of-discrete/65369/5 "2022-07-20T15:26:22Z")

</div>

Will do... These are 2014 Pi's and unbelievably slow to get into the interfaces.

---

<div class="post-metadata">

**Author:** ![Rgrove](https://avatars.discourse-cdn.com/v4/letter/r/5f8ce5/32.png) [@Rgrove](https://discourse.nodered.org/u/Rgrove)\
**Post date:** [20 July 2022 16:27 UTC](https://discourse.nodered.org/t/websockets-passing-all-msg-properties-as-payload-instead-of-discrete/65369/6 "2022-07-20T16:27:54Z")

</div>

Didn't realize there was a bunch of sensitive data in the flows, doing find/replace in notepad now.

---

<div class="post-metadata">

**Author:** ![Rgrove](https://avatars.discourse-cdn.com/v4/letter/r/5f8ce5/32.png) [@Rgrove](https://discourse.nodered.org/u/Rgrove)\
**Post date:** [20 July 2022 16:48 UTC](https://discourse.nodered.org/t/websockets-passing-all-msg-properties-as-payload-instead-of-discrete/65369/7 "2022-07-20T16:48:38Z")

</div>

I can't fit the code, keeps saying I'm exceeding the character limit. Using code tags.

---

<div class="post-metadata">

**Author:** ![Rgrove](https://avatars.discourse-cdn.com/v4/letter/r/5f8ce5/32.png) [@Rgrove](https://discourse.nodered.org/u/Rgrove)\
**Post date:** [26 July 2022 16:07 UTC](https://discourse.nodered.org/t/websockets-passing-all-msg-properties-as-payload-instead-of-discrete/65369/8 "2022-07-26T16:07:51Z")

</div>

Well, it's solved, but I'm not really sure how.

No change:

- reinstalled NR a dozen times, and made sure versions matched on the working unit and the non-working unit.
- rebuilt the flow from the ground up
- reloaded the OS, restored the flow from backup
- replaced the Pi with a Pi 3, made sure OS and NR versions matched between working and non-working units

Change (solved):

- created a new websocket channel on each end and replaced the old one.

I thought I had done this when rebuilding the flow, but I likely didn't actually delete the websocket, and it seems the websocket itself was somehow corrupt, not the nodes or flow. "Entire message" was selected in the websocket config. The new and old websockets appear to be identical, but one works corectly and the other doesn't.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [9 August 2022 16:08 UTC](https://discourse.nodered.org/t/websockets-passing-all-msg-properties-as-payload-instead-of-discrete/65369/9 "2022-08-09T16:08:30Z")

</div>

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