Using cookie-session with express.io
Opened this issue · 0 comments
khalilTN commented
I'm trying to use _cookie-session_ with _express.io_ and so avoid using _MemoryStore_
This is my code :
express = require('express.io');
app = express().http().io();
require('express.io-middleware')(app);
app.use(express.cookieParser());
var session = require('cookie-session');
app.use(express.session({secret: 'hygdfreiliu'}));
app.io.use(function(req, next) {
if (req.session.user || (req.io.event === "user:login")) {
try {
next();
}
catch(err){
__debug.error('REQUEST_ERROR');
var result = new (require("./core/result.js"))();
result.notification.error("#REQUEST_ERROR");
req.io.respond(result);
}
}
});
An exception occurs:
TypeError: object is not a function
at /home/dev/svn/webmail2/node_modules/express.io/compiled/index.js:107:20
at iterate (/home/dev/svn/webmail2/node_modules/express.io/node_modules/async/lib/async.js:108:13)
at Object.async.forEachSeries (/home/dev/svn/webmail2/node_modules/express.io/node_modules/async/lib/async.js:124:9)
at Manager.<anonymous> (/home/dev/svn/webmail2/node_modules/express.io/compiled/index.js:106:24)
at Manager.authorize (/home/dev/svn/webmail2/node_modules/express.io/node_modules/socket.io/lib/manager.js:925:31)
at Manager.handleHandshake (/home/dev/svn/webmail2/node_modules/express.io/node_modules/socket.io/lib/manager.js:801:8)
at Manager.handleRequest (/home/dev/svn/webmail2/node_modules/express.io/node_modules/socket.io/lib/manager.js:616:12)
at Server.<anonymous> (/home/dev/svn/webmail2/node_modules/express.io/node_modules/socket.io/lib/manager.js:119:10)
at Server.emit (events.js:98:17)
at HTTPParser.parser.onIncoming (http.js:2108:12)
How can i avoid this problem, is there another way to avoid using _MemoryStore_ besides using another database like _mongo_ or _redis_ ?