implementation code to test the internet connection before pulling data for chat