How to check for network connection continuously?

Is there any way like event listener to check for network state continuously while running the app in browser or RDK devices.
We want to show no internet screen when network connection goes out , any help would be much appreciated.

Hi @Ajay, you could try to use the Navigator.connection WebAPI: Navigator.connection - Web APIs | MDN

I’m not 100% sure this is supported on RDK devices, though. If it’s not available, then you might need to look into retrieving network state via Thunder.

1 Like

Another solution, while not elegant, is to continuously ping an endpoint which you know that will “always be up”, and if for any reason it times out or whatever, you can assume the application does not have internet connection. As to how often you should ping that endpoint is entirely up to you.