Check Real-time API Connection Angularjs

Asked

Viewed 465 times

0

I know it is possible to verify the existence of internet connection, but it would be possible to check if my application is connected to the API where both are on the local network.

For example, in case of a network problem and this application is unable to communicate with the API a message would appear informing the user about the situation.

What would be the steps to achieve this result?

1 answer

1

The ideal would be to 'drip' the api in a pre-established time interval, like 10 sec.

I’ve used it like this.

Ai if ping returns an error we inform the user.

  • At first I thought about it too, but I was a little afraid of "weighing" the application. This could happen?

  • Use ping and return with as little data as possible ex: a json with variable status and value 1 or maybe just a return with 1, will USE very little network resource and will not slow anything down

Browser other questions tagged

You are not signed in. Login or sign up in order to post.