0

In my Angular app I am fetching data from an api service which provides me JSON data. I have several values in fetched data. See the example:

{
    "StartDate": "2020-07-06 23:29:01",
    "Visits": 1,
    "Clicks": 1,
    "FormSuccess": 0,
    "FormFailures": 0,
}

On my Angular App I have made a dashboard which shows these numbers. As you can see these numbers will change by time...

Is there a "smarter" way to put a listener to this API Get url and whenever changes happens to these, it should refresh my dashboard with the new figures?

my JSON get looks like this:

ngOnInit(): void {
    this.http.get("https://myapiurl/info", this.httpOptions)
      .subscribe((data) => {
        this.jsonArray = data;
      })
  }
surendra kumar
  • 1,686
  • 11
  • 15
Danny Web
  • 217
  • 5
  • 17

1 Answers1

0

You can use WebSockets for this

Similar Answer

If you are using the MongoDB as a database then you can try minimongo packages it has a DB subscription for UI, but we have to take care of security threats

mad Man
  • 366
  • 3
  • 7