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

unable to save session in socket.io #1

Closed
tbenst opened this issue Jun 8, 2016 · 4 comments
Closed

unable to save session in socket.io #1

tbenst opened this issue Jun 8, 2016 · 4 comments

Comments

@tbenst
Copy link

tbenst commented Jun 8, 2016

First of all, thank you for making this! Very convenient.

I am unable to make permanent changes to the session from socket.io, although I am able to read the session. Is there a way to modify the session from socket.io?

Can read and write:

router.get('/count', ctx => {
    var session = ctx.session;
    session.count = session.count || 0;
    session.count++;
    ctx.body = session.count;
})

Can only read:

io.on('test', (ctx, data) => {
    var session = ctx.session;
    session.count = session.count || 0;
    session.count++;
    console.log('test get count', ctx.session.count)
})
@LnsooXD
Copy link
Owner

LnsooXD commented Jun 15, 2016

I'm so sorry that i was in holiday a few days. I will check the issues.

@tbenst
Copy link
Author

tbenst commented Jun 20, 2016

Enjoy your holiday! When you are back, let me know if I can help troubleshoot.

@niftylettuce
Copy link

something like ctx.sessionStore.set(ctx.sessionId, ctx.session)

@LnsooXD
Copy link
Owner

LnsooXD commented Aug 30, 2016

@tbenst Did you solve this problem yet? I solved a problem in module cookies. And The code above works fine in my project.

@LnsooXD LnsooXD closed this as completed Sep 5, 2016
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

3 participants