moved socket.io code from server.js to lib/services/socket.js