Router middleware for socket.io