'How do I use session middleware with multiple socket io namespaces?

io.of('/nsp').use(function(socket, next) {
    sessionMiddleware(socket.request, {}, next);
})    
io.of('/nsp').on('connection', (socket) => {
      someFunc(socket)
});

When I use this, it works. But I need session to work with multiple namespaces. If I add it to default, it couldn't be accessed by namespace. When I created different sessionMiddleware, it also didn't work.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source