better mock function on client side, server ip in global variable