Move socket.io logic out out express call.