client side socket implementation and api response for requests