I am using express with socket.io. I need both the express requests and socket.io to use the latest version of the express-session, for consistency. The way I had to do it previously was with:
req.session.reload(()=>{
//edit or read
req.session.save() //if edited
}
socket.request.session.reload(()=>{
//edit or reload
socket.request.session.save()
}
This meant that my code became very large, and would have issues if requests and socket.io tried to write at the same time.
Instead I am considering using:
redisClient.get(redisSessionId, (err, session) => {JSON.parse(session)})
or:
redisClient.set(redisSessionId, JSON.stringify(session), (err) => {})
My question is, would this be a good decision? Are there any issues to be aware of?