Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Passport middleware for Socket.IO
JavaScript
branch: master
Failed to load latest commit information.
test fix style
.gitignore Initial commit
.npmignore Initial commit
.travis.yml Initial commit
LICENSE Initial commit
README.md Release 0.1.1
index.js fix style
package.json Release 0.1.1

README.md

socket.io-passport

Build Status

Passport middleware for Socket.IO.

Installation

$ npm install socket.io-passport

Usage

Use with socket.io-bundle.

var passport = require('passport');
var bundle = require('socket.io-bundle');
var ioPassport = require('socket.io-passport');
var server = require('http').Server();
var io = require('socket.io')(server);

passport.deserializeUser(function(id, done) {
  done(null, {id: id, name: 'foo'});
});

io.use(bundle.cookieParser());
io.use(bundle.session({secret: 'my secret'}));
io.use(ioPassport.initialize());
io.use(ioPassport.session());

io.on('connection', function(socket) {
  console.log(socket.request.user);
});

server.listen(3000);

License

MIT

Something went wrong with that request. Please try again.