Skip to content

Commit cbef165

Browse files
committed
feat(middleware): add wsHandle to be websocket complaint
1 parent d8e5b3a commit cbef165

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

src/Session/Middleware.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,22 @@ class SessionMiddleware {
7676
await ctx.session.commit()
7777
}
7878
}
79+
80+
/**
81+
* Initiates the session store in ready only mode
82+
*
83+
* @method wsHandle
84+
*
85+
* @param {Session} options.session
86+
* @param {Function} next
87+
*
88+
* @return {void}
89+
*/
90+
async wsHandle ({ session }, next) {
91+
await session.instantiate(true)
92+
debug('session store initiated in read only mode')
93+
await next()
94+
}
7995
}
8096

8197
module.exports = SessionMiddleware

0 commit comments

Comments
 (0)