# How can I recover a json message from a distant server?

**URL:** <https://discourse.nodered.org/t/how-can-i-recover-a-json-message-from-a-distant-server/17217>\
**Category:** General\
**Created:** [28 October 2019 07:35 UTC](https://discourse.nodered.org/t/how-can-i-recover-a-json-message-from-a-distant-server/17217 "2019-10-28T07:35:59Z")\
**Posts on this page:** 13\
**Page:** 2

<div class="post-metadata">

**Author:** ![chris35](https://avatars.discourse-cdn.com/v4/letter/c/898d66/32.png) [@chris35](https://discourse.nodered.org/u/chris35)\
**Post date:** [29 October 2019 09:46 UTC](https://discourse.nodered.org/t/how-can-i-recover-a-json-message-from-a-distant-server/17217/21 "2019-10-29T09:46:55Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [29 October 2019 09:54 UTC](https://discourse.nodered.org/t/how-can-i-recover-a-json-message-from-a-distant-server/17217/22 "2019-10-29T09:54:39Z")

</div>

And how have you configured the remote server? Is there a screenshot or similar you can show?

---

<div class="post-metadata">

**Author:** ![chris35](https://avatars.discourse-cdn.com/v4/letter/c/898d66/32.png) [@chris35](https://discourse.nodered.org/u/chris35)\
**Post date:** [29 October 2019 09:57 UTC](https://discourse.nodered.org/t/how-can-i-recover-a-json-message-from-a-distant-server/17217/23 "2019-10-29T09:57:47Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![cymplecy](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/cymplecy/32/2773_2.png) [@cymplecy](https://discourse.nodered.org/u/cymplecy)\
**Post date:** [29 October 2019 10:02 UTC](https://discourse.nodered.org/t/how-can-i-recover-a-json-message-from-a-distant-server/17217/24 "2019-10-29T10:02:31Z")

</div>

Try changing your port from 9000 to 1880

---

<div class="post-metadata">

**Author:** ![chris35](https://avatars.discourse-cdn.com/v4/letter/c/898d66/32.png) [@chris35](https://discourse.nodered.org/u/chris35)\
**Post date:** [29 October 2019 10:31 UTC](https://discourse.nodered.org/t/how-can-i-recover-a-json-message-from-a-distant-server/17217/25 "2019-10-29T10:31:30Z")

</div>

doesn't work

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/9/9d16ece2b7e843dfff1c12f3b1295a1492824c6b.png)

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [29 October 2019 10:37 UTC](https://discourse.nodered.org/t/how-can-i-recover-a-json-message-from-a-distant-server/17217/26 "2019-10-29T10:37:44Z")

</div>

The configuration of the remote server you shared showed you still have it configured to connect to port 9000. That is wrong - it should be set to whatever port node-red is listening on - which is 1880 by default.

So when you say "doesn't work" without any further information about what you actually did, it is really hard to help. What did you change exactly to get that error? We are telling you to change the configuration of the remote server - so why that would cause an error in the local node-red debug window is very unclear.

---

<div class="post-metadata">

**Author:** ![chris35](https://avatars.discourse-cdn.com/v4/letter/c/898d66/32.png) [@chris35](https://discourse.nodered.org/u/chris35)\
**Post date:** [29 October 2019 10:45 UTC](https://discourse.nodered.org/t/how-can-i-recover-a-json-message-from-a-distant-server/17217/27 "2019-10-29T10:45:17Z")

</div>

ok .... I change the port of my remote server to 1880....  
and there is no message in the debug node :  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/c/cf31cf70678bc203091f753b4c52f045621c370b.png)

---

<div class="post-metadata">

**Author:** ![chris35](https://avatars.discourse-cdn.com/v4/letter/c/898d66/32.png) [@chris35](https://discourse.nodered.org/u/chris35)\
**Post date:** [29 October 2019 12:43 UTC](https://discourse.nodered.org/t/how-can-i-recover-a-json-message-from-a-distant-server/17217/28 "2019-10-29T12:43:03Z")

</div>

to go further I would like to use the node switch to send the message in a direction according to the value of sensorInstallId  
is it a good idea ?  
I've read [Switch node - jsonata - magic?](https://discourse.nodered.org/t/switch-node-jsonata-magic/12943)  
but I don't understand if the "Key is" exist or not ?

for the moment I've made this

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/3/303f7059480cfd64f44cb68ae3fd74a24ee8619a.png)

but the property 1 doesn't match .... it's the otherwise property(6) which send a debug message  
What's wrong in my reflexion ?

Thanks

---

<div class="post-metadata">

**Author:** ![bakman2](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bakman2/32/6207_2.png) [@bakman2](https://discourse.nodered.org/u/bakman2)\
**Post date:** [29 October 2019 12:45 UTC](https://discourse.nodered.org/t/how-can-i-recover-a-json-message-from-a-distant-server/17217/29 "2019-10-29T12:45:47Z")

</div>

In the switch node use "contains" or "==" instead of Jsonata. Search for values without quotes.

---

<div class="post-metadata">

**Author:** ![ukmoose](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ukmoose/32/13_2.png) [@ukmoose](https://discourse.nodered.org/u/ukmoose)\
**Post date:** [29 October 2019 13:02 UTC](https://discourse.nodered.org/t/how-can-i-recover-a-json-message-from-a-distant-server/17217/30 "2019-10-29T13:02:36Z")

</div>

So it's now working? If so what change did you make between your two posts?

---

<div class="post-metadata">

**Author:** ![chris35](https://avatars.discourse-cdn.com/v4/letter/c/898d66/32.png) [@chris35](https://discourse.nodered.org/u/chris35)\
**Post date:** [29 October 2019 13:10 UTC](https://discourse.nodered.org/t/how-can-i-recover-a-json-message-from-a-distant-server/17217/31 "2019-10-29T13:10:07Z")

</div>

the solution by [bakman2](https://discourse.nodered.org/u/bakman2) works because I make a simulation of a message .... I will like to test the switch node and the differents rules.  
thanks [bakman2](https://discourse.nodered.org/u/bakman2)😀  
thanks [cymplecy](https://discourse.nodered.org/u/cymplecy) for the simulation of message 😀

the part with node "HTTP IN" doesn't works ....

---

<div class="post-metadata">

**Author:** ![cymplecy](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/cymplecy/32/2773_2.png) [@cymplecy](https://discourse.nodered.org/u/cymplecy)\
**Post date:** [29 October 2019 14:12 UTC](https://discourse.nodered.org/t/how-can-i-recover-a-json-message-from-a-distant-server/17217/33 "2019-10-29T14:12:46Z")

</div>

> [@chris35](#):
>
> thanks [cymplecy](https://discourse.nodered.org/u/cymplecy) for the simulation of message 😀

Try putting your original TCP node instead of the simulated inject node (remember to change back to using port 9000)

---

<div class="post-metadata">

**Author:** ![chris35](https://avatars.discourse-cdn.com/v4/letter/c/898d66/32.png) [@chris35](https://discourse.nodered.org/u/chris35)\
**Post date:** [29 October 2019 14:17 UTC](https://discourse.nodered.org/t/how-can-i-recover-a-json-message-from-a-distant-server/17217/34 "2019-10-29T14:17:56Z")

</div>

yes I've tested your solution in real usage [cymplecy](https://discourse.nodered.org/u/cymplecy)  
and it's work fine....  
and now I can steer my sensor data stream where I want 😀  
by cons I still do not understand why "http in" does not work

[Previous page](https://discourse.nodered.org/t/how-can-i-recover-a-json-message-from-a-distant-server/17217.md?page=1)
