function to make dynamic requests on a http Socket