a implement of ping in javascript and angularjs