我有两台服务器:
我正在尝试使用socket.io服务器中的“session.socket.io”模块读取会话。 但我明白了:
“错误:无法按键查找会话:jsessionid”
// Session
var session = require('express-session');
var RedisStore = require('connect-redis')(session);
app.use(session({store: new RedisStore(), key:'jsessionid', secret:credentials.cookieSecret}));
app.use(require('cookie-parser')(credentials.cookieSecret));
// Cookie
var cookieParser = require('cookie-parser');
app.use(cookieParser(credentials.cookieSecret));
// Session
var session = require('express-session');
var RedisStore = require('connect-redis')(session)
, redisStore = new RedisStore();
app.use(session({store: redisStore , key:'jsessionid', secret:credentials.cookieSecret}));
var SessionSockets = require('session.socket.io')
, sessionSockets = new SessionSockets(io, redisStore , cookieParser(), 'jsessionid');
sessionSockets.on('connection', function(err, socket, session) {
console.log('connection event occured');
console.log("session is: " + session);
console.log("error is: " + err);
});
为什么会这样?