rework socket.js to be able to switch between different servers as needed