Read the statement by Michael Teeuw here.
ECONNREFUSED when trying to get JSON from my server (MMM-json-feed)
-
@toh1000 Please post JSON response. I just spent a day trying to figure out why MM is so fickly regarding non-perfect JSON being sent over the socket. Loading JSON from a variable, just fine. Pushing the exact same JSON over a socket…had problems.
BTW. Is it correct that it says your JSON is GZIP encoded, no??
-
-
@E3V3A Also, @toh1000’s HTTP request included the header
Accept-Encoding: gzip, deflate
, so the test site responded withContent-Encoding: gzip
. That’s totally appropriate, and usually this is handled transparently by the client, which will then provide the uncompressed response. However, the actual service (“My service”) responded with no compression. -
From here:
ECONNREFUSED (Connection refused): No connection could be made because the target machine actively refused it. This usually results from trying to connect to a service that is inactive on the foreign host.
-
Here’s an example in my node helper I use to get json
request({ url: "xxxxxxxxxxxx.json", method: 'GET', headers: { 'User-Agent': 'MagicMirror/1.0 (' + this.config.email + ')' }
-
@ninjabreadman Yes, curl call returns correct json:
{"Date": "22.02.2018", "Temperature": -0.187, "Time": "22:45:37"}
-
@E3V3A Any idea what I could do to accept the connection?
-
@cowboysdude I added the header (without the this.config.email) but got the same result.
-
Solved:
The problem was that the module translated the server name into an up address and CherryPy was not configured to response to that.
Reconfiguring did the trick:
this article explains how this is done
Thanks for your efforts.