Communicate with server abstracting the transport type (ajax or sockets.io)