socket.io-handshake
socket.io v1.x sessions
Last updated 5 years ago by nromano .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install socket.io-handshake 
SYNC missed versions from official npm registry.

Build Status NPM version David DM

Session middleware for socket.io v1.x;

Examples

var socketSessions = require('socket.io-handshake');
var io = require('socket.io')(3000);
io.use( socketSessions() );

Using connect-redis for our session store.

var session = require('express-session');
var RedisStore = require('connect-redis')(session);
var sessionStore = new RedisStore();
var cookieParser = require('cookie-parser');
var socketHandshake = require('socket.io-handshake');

var io = require('socket.io')(3000);
io.use(socketHandshake({store: sessionStore, key:'sid', secret:'secret', parser:cookieParser()}));

To access the session data.

io.on('connection' function (sock) {
  if (!sock.handshake.session.name) {
    sock.emit('get name');
  };
  sock.on('set nama', function (name) {
    sock.handhsake.session.name = name;
    sock.handshake.session.save();
  });
});

Installation and Environment Setup

Install node.js (See download and install instructions here: http://nodejs.org/).

Clone this repository

> git clone git@github.com:turbonetix/socket.io-handshake.git

cd into the directory and install the dependencies

> cd socket.io-handshake
> npm install && npm shrinkwrap --dev

Running Tests

Install coffee-script

> npm install coffee-script -g

Tests are run using grunt. You must first globally install the grunt-cli with npm.

> sudo npm install -g grunt-cli

Unit Tests

To run the tests, just run grunt

> grunt spec

TODO

Current Tags

  • 0.0.10                                ...           latest (5 years ago)

9 Versions

  • 0.0.10                                ...           5 years ago
  • 0.0.9                                ...           6 years ago
  • 0.0.8                                ...           6 years ago
  • 0.0.7                                ...           6 years ago
  • 0.0.6                                ...           6 years ago
  • 0.0.5                                ...           6 years ago
  • 0.0.4                                ...           6 years ago
  • 0.0.3                                ...           6 years ago
  • 0.0.1                                ...           6 years ago
Maintainers (1)
Downloads
Today 0
This Week 9
This Month 10
Last Day 0
Last Week 1
Last Month 0
Dependencies (3)
Dev Dependencies (5)
Dependents (2)

Copyright 2014 - 2016 © taobao.org |