adding a long polling function to my utils file