added socket logic in server.js