Closed Zensey closed 4 years ago
can you explain the impact if we generate new session for websocket?
Nothing will broke, but session will be wasted.
In websocket session there is no response object, its not http connection whith request and responce. there is only upgradeReq object, so cookie will come to nowhere.
If I have no session, created earlier during http transaction, new session will be generated each time I connect to websocket.
There is the only goal of invoking generic-session middleware from websocket: to reuse http-generated session and session objects.
Example how I invoke middleware when websocket connect:
try {
var ctx = koa.createContext(client.upgradeReq, {statusCode: null});
yield generic_session.bind(ctx)(noop);
}
Can you add a test? Not sure if you still use this.
Forbid generating new session when being invoked from websocket session. Use case: using this middleware from koa-websocket.