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