Node.js Socket.IO无刷新授权

Node.js Socket.IO无刷新授权,node.js,socket.io,authorization,Node.js,Socket.io,Authorization,在第一次调用localhost时,它发送index.html并尝试授权。 授权当然不被批准。用户在index.html中填写表单后,执行“app.post('/login'…” 我现在想要的是,登录后的授权将执行一次,并且具有Socket.IO的客户端将连接 这是可能的吗?还是我必须在客户端登录后刷新页面 app.post('/login', function(req, res) { req.session.status = { test:111 }; r

在第一次调用localhost时,它发送index.html并尝试授权。 授权当然不被批准。用户在index.html中填写表单后,执行“app.post('/login'…”

我现在想要的是,登录后的授权将执行一次,并且具有Socket.IO的客户端将连接

这是可能的吗?还是我必须在客户端登录后刷新页面

app.post('/login', function(req, res) {
    req.session.status = {
        test:111
    };
    res.end();
});

app.get('/', function(req, res){
    res.sendfile(__dirname + '/index.html');
});

io.set('authorization', function(req, callback) {
    console.log("hi");
    // check if user is logged, if yes connect with socket.io
});

io.sockets.on('connection', function(socket){
});