JedWatson/keystone — pull request #408 by killerbobjr (2014-06-07 15:14:32+00:00)
Title: Exposes session store, cookie parser, and session key.

Changes:
1. Exposes session store, cookie parser, and session key which allows session.socket.io to match the current session with the socket.io connection in that session.
2. Add a switch to enable the turning off of the view engine cache in development mode. This helps when debugging other engines like swig.

Keystone session.socket.io example:

keystone.start(
{
onHttpServerCreated: function()
{
keystone.app.io = require('socket.io').listen(keystone.httpServer);
keystone.app.sessionsocketio = new require('session.socket.io')(keystone.app.io, keystone.app.sessionOpts.store, keystone.app.sessionOpts.cookieParser, keystone.app.sessionOpts.key);
keystone.app.sessionsocketio.on('connection', function (err, socket, session) {
socket.emit('alert', { message: 'socket.io is connected to session: ' + session });
});
}
});

Socket.io v1.x HTML example: