0
我正在使用nodejs express-session和express-socket.io-session,問題是當我運行我的server.js時,有一些錯誤:使用快速會話和express-socket.io會話的錯誤NodeJs
express-session deprecated undefined resave option; provide resave option node_modules\express-socket.io-session\index.js:66:7
express-session deprecated req.secret; provide secret option node_modules\express-socket.io-session\index.js:66:7
express-session deprecated undefined saveUninitialized option; provide saveUninitialized option node_modules\express-socket.io-session\index.js:66:7
下面是代碼:
var express = require('express');
var session = require('express-session');
var io = require('socket.io').listen(http);
var sharedsession = require("express-socket.io-session");
var app = express();
app.use(session({
secret: 'ssshhhhh',
resave: true,
saveUninitialized: true
}));
io.use(sharedsession(session, {
resave: true,
secret: 'ssshhhhh',
saveUninitialized: true
}));
io.sockets.on('connection', function(socket){
console.log(socket.handshake.session);
});
我希望我已經清楚我的問題。謝謝
@ireeqhz答案仍然適用,您不會將已配置的會話傳遞到socket.io中,您將傳遞給會話構造函數的引用。 – James