MCPcopy
hub / github.com/socketio/socket.io / onlyForHandshake

Function onlyForHandshake

examples/passport-example/cjs/index.js:80–89  ·  view source on GitHub ↗
(middleware)

Source from the content-addressed store, hash-verified

78const io = new Server(httpServer);
79
80function 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
91io.engine.use(onlyForHandshake(sessionMiddleware));
92io.engine.use(onlyForHandshake(passport.session()));

Callers 1

index.jsFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected