ok, i setup session.socket.io and my socket is working. But working with session i got javascript object instead of mongo record. So i can't perform this code (as shown):
sessionSockets.on('connection', function (err, socket, session) {
session.foo = 'bar';
//at this point the value is not yet saved into the session
session.save();
//now you can read session.foo from your express routes or connect middlewares
});
Becouse of you get unserialized record:
https://github.com/kcbanner/connect-mongo/blob/master/lib/connect-mongo.js
MongoStore.prototype.get = function(sid, callback) {
var self = this;
this._get_collection(function(collection) {
collection.findOne({_id: sid}, function(err, session) {
try {
if (err) {
callback && callback(err, null);
} else {
if (session) {
if (!session.expires || new Date < session.expires) {
callback(null, self._unserialize_session(session.session));
...
ok, i setup session.socket.io and my socket is working. But working with session i got javascript object instead of mongo record. So i can't perform this code (as shown):
Becouse of you get unserialized record:
https://github.com/kcbanner/connect-mongo/blob/master/lib/connect-mongo.js