Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

express-socket.io-session

Package Overview
Dependencies
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

express-socket.io-session

Share a cookie-based express-session middleware with socket.io

  • 1.0.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
5.8K
decreased by-0.48%
Maintainers
1
Weekly downloads
 
Created
Source

express-socket.io-session

Share a cookie-based express-session middleware with socket.io (Experimental)

THIS MODULE IS EXPERIMENTAL. IT WORKS. BUT IT WON'T WORK AS EXPECTED YET BECAUSE I STILL DON'T KNOW WHAT TO EXPECT FROM IT.

On every socket connection, you'll have socket.handshake.session pointing to the same req.session you would expect in any express app handler that uses the express-session middleware module.

##Installation

$ npm install express-socket.io-session

Usage

$ npm install express socket.io express-session 
$ npm install express-socket.io-session

index.js

var app = require('express')(),
  server  = require("http").createServer(app),
  io = require("socket.io")(server),
  session = require("express-session")({
    secret: "my-secret",
    resave: true,
    saveUninitialized: true
  }),
  sharedSession = require("express-socket.io-session");


// Attach session
app.use(session);

// Share session with io sockets

io.use(sharedSession(session));

server.listen(3000);

##License

MIT

Keywords

FAQs

Package last updated on 20 Jan 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc