added long poll function to the js