We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
https://github.com/koajs/session/blob/6.1.0/lib/context.js#L38
On the linked line from the file above, it's either create new session or initialized from cookie when retrieving a session i.e ctx.session.something.
ctx.session.something
Why does it not support initializing from external as well (on this specific part of the code. external init is being called somewhere else)?
Is this intended?
An example where this might happen is the following:
const response = request(koaApp).post('/give-me-session'); const cookie = extractCookieFromResponse(response); const websocket = new WebSocket('ws://<address:port>/ws/use-my-session'); // Websocket Handler function websocketHandler(req) { const ctx = koaApp.createContext(req); const authenticated = ctx.session.userId; }
If I were to use cookies, this would work because of the highlighted line above but otherwise it's going to be a new session.
Is this intended? Is this wrong?
Workaround would be:
async function websocketHandler(req) { const ctx = koaApp.createContext(req); const sessionId = ctx.cookies.get('koa.sess'); const sessionData = await koaSessionStore.get(sessionId); }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
https://github.com/koajs/session/blob/6.1.0/lib/context.js#L38
On the linked line from the file above, it's either create new session or initialized from cookie when retrieving a session i.e
ctx.session.something
.Why does it not support initializing from external as well (on this specific part of the code. external init is being called somewhere else)?
Is this intended?
An example where this might happen is the following:
If I were to use cookies, this would work because of the highlighted line above but otherwise it's going to be a new session.
Is this intended? Is this wrong?
Workaround would be:
The text was updated successfully, but these errors were encountered: