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

Function onlyForHandshake

examples/passport-example/esm/index.js:83–92  ·  view source on GitHub ↗
(middleware)

Source from the content-addressed store, hash-verified

81const io = new Server(httpServer);
82
83function 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
94io.engine.use(onlyForHandshake(sessionMiddleware));
95io.engine.use(onlyForHandshake(passport.session()));

Callers 1

index.jsFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected