replace ajax API calls with socket.io