Right now you can bind middleware to io.use(middleware);
, but this is triggered only when a socket connection is made. Is there a way to intercept it before passing it to an event handle like in expressjs?
In other word....
In express.js you can do:
app.get('/', middleware1, middleware2, function(req, res){
res.end();
});
Can I do the same in socket.io?
socket.on('someEvent', middleware1, middleware2, function(data){
console.log(data); // data is now filtered by 2 previous middlewares
});