(middleware)
| 78 | const io = new Server(httpServer); |
| 79 | |
| 80 | function onlyForHandshake(middleware) { |
| 81 | return (req, res, next) => { |
| 82 | const isHandshake = req._query.sid === undefined; |
| 83 | if (isHandshake) { |
| 84 | middleware(req, res, next); |
| 85 | } else { |
| 86 | next(); |
| 87 | } |
| 88 | }; |
| 89 | } |
| 90 | |
| 91 | io.engine.use(onlyForHandshake(sessionMiddleware)); |
| 92 | io.engine.use(onlyForHandshake(passport.session())); |