Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using cookie-session with express.io #118

Open
khalilTN opened this issue Mar 12, 2015 · 0 comments
Open

Using cookie-session with express.io #118

khalilTN opened this issue Mar 12, 2015 · 0 comments

Comments

@khalilTN
Copy link

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_ ?

@khalilTN khalilTN changed the title Expre Using cookie-session with express.io Mar 12, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant