You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, I'd like to use redis as persistent sessionStore inside Socket.IO, probably I'm missing something because if I write the sessionStore from inside socket.io it is written in the memory store and not in redis.
some code parts:
express=require'express'http=require'http'redis=require'redis'connect=require('connect')
RedisStore=require('connect-redis')(express)
SessionSockets=require('session.socket.io')
app=module.exports=express()
app.set('port', 3000)
server=app.listenapp.get('port')
io=require('socket.io').listen server
cookieParser=express.cookieParser('your secret sauce2')
# Redis as sessioStoresessionStore=newRedisStoresessionSockets=newSessionSockets(io, sessionStore, cookieParser)
sessionSockets.on"connection", (err, socket, session) -># ..socket.on"ping", (data) -># Doesn't work, counter IS NOT saved in redisifsession.counter++session.counterelsesession.counter=1console.log'@sess2: '+JSON.stringify session
app.get"/test", (req, res) ->body=""# Works, view IS saved in redisifreq.session.views++req.session.viewselsereq.session.views=1body+="<p>First time visiting? view this page in several browsers :)</p>"res.send body +"<p>viewed <strong>"+req.session.views+"</strong> times.</p>"
The connect.sid session is in redis but "counter" is in memorystore I think
redis 127.0.0.1:6379> get sess:o0wxRV+ykXOIxT3FNwsIG9OX
"{\"cookie\":{\"originalMaxAge\":null,\"expires\":null,\"httpOnly\":true,\"path\":\"/\"}}"
Hi, I'd like to use redis as persistent sessionStore inside Socket.IO, probably I'm missing something because if I write the sessionStore from inside socket.io it is written in the memory store and not in redis.
some code parts:
The connect.sid session is in redis but "counter" is in memorystore I think
see also:
wcamarao/session.socket.io#2 (comment)
The text was updated successfully, but these errors were encountered: