Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem with making updateData work with remote endpoints #119

Open
denismakogon opened this issue Apr 15, 2018 · 4 comments
Open

Problem with making updateData work with remote endpoints #119

denismakogon opened this issue Apr 15, 2018 · 4 comments

Comments

@denismakogon
Copy link

denismakogon commented Apr 15, 2018

Original issue: Netflix/vizceral-example#42

So, the idea is pretty straightforward, i have an endpoint that ships config in application/json or application/octet-stream format, the content of the response is valid (tried to save data into a file and it worked).
But when i'm trying to make an application get the config from the endpoint - UI starts hanging forever, code looks like:

  beginSampleData () {
      this.traffic = { nodes: [], connections: [] };
      request.get('https://<service-endoint>/config.json')
          .set('Accept', 'application/json')
          .end((err, res) => {
              if (res && res.status === 200) {
                  this.traffic.clientUpdateTime = Date.now();
                  this.updateData(res.body);
              }
          });
  }

I can see that the app is capable to reach out my endpoint and the request was successful, but no luck displaying the graph, unfortunately.

@jrsquared
Copy link
Contributor

Isn't res.body a string? You have to JSON.parse(res.body) first. Or if you are using fetch, use res.json().

@denismakogon
Copy link
Author

thanks, will try definitely. Will post an update as soon as possible.

@denismakogon
Copy link
Author

Unfortunately, nothing changed, UI still hangs attempting to render the UI.
Endpoint returns a valid JSON object:

< HTTP/1.1 200 OK
< Content-Length: 2042
< Content-Type: application/json
< Date: Wed, 18 Apr 2018 17:37:23 GMT

and i applied JSON.parse function to a body, still nothing.

@eperry
Copy link

eperry commented Jul 22, 2018

you could try the way I did it

git clone https://github.com/eperry/node-red-contrib-viceral

Follow the install in README.md.

I used an App called "NODE-Red" which hosts the vizceral site/example

And instead of changing the example/code site. I made the data file "Dynamic" this way there is no changes to the endpoints.

plus with node-red I can build work flows to populate the data. (As provided in my example it works with Elasticsearch)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants