changes in server.js to manage two connections