Reactive HTTP and responding to attribute changes in response

Does this mean that if I am making a http.get call and one of the attributes within the response changes from

{ ‘name’: ‘John’}

to

{'name: ‘David’}

changes, will Meteor’s reactive nature also updates UI that’s reference to it? i.e Removing the need for continuous polling? I just want to do something only when the specified value changes, without having to continously polling and making HTTP.get call?

HTTP.get by itself isn’t reactive, but there are ways you can make this work. It really depends on your environment and how you’re setting things up, but a few suggestions:

  • Are you using HTTP.get to consume a REST based web service? If so take a look at the okgrow:rest2ddp package for some reactive goodness.
  • Otherwise, take a look at the simple:reactive-method package to see how you can start to wire this up yourself.

Hi @hwillson

Thanks I will certainly look into it.

I looked at rest2ddp but problem is my end as I am working with a response (from legacy code) that looks like

200
{
records: [
‘name’: XXX,
'age: 42,
Etc
Etc
]
}

Which is valid JSON, if the status code is first removed. At the moment rest2ddp URL attribute won’t parse this type of response, so I am open to suggestions how to handle this case scenario.

Thought about manually using HTTP.call(‘get’…) and then simply string.replace(“200”, “”) but then I am no longer using the rest2ddp library unless there is some way to modify the URL or something along the line?

Seb