
Security News
Axios Maintainer Confirms Social Engineering Attack Behind npm Compromise
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.
koa-socket-session
Advanced tools
#Koa-socket-session
koa-socket-session is a session middleware for LnsooXD/koa-socket.io.It can share session between koa app and koa-socket.io.
##Installation
$ npm install koa-socket-session
##Example
A chat room example can be found under example dir.
var koa = require('koa');
var koaSession = require('koa-session');
var koaSocketSession require('koa-socket-session');
var IO = require('koa-socket.io');
const http = require('http');
var app = koa();
var io = IO();
const CONFIG = {
key: 'koa:sess', /** (string) cookie key (default is koa:sess) */
maxAge: 86400000, /** (number) maxAge in ms (default is 1 days) */
overwrite: true, /** (boolean) can overwrite or not (default true) */
httpOnly: true, /** (boolean) httpOnly or not (default true) */
signed: true, /** (boolean) signed or not (default true) */
};
app.keys = ['some secret hurr'];
// init session
var session = koaSession({
secret: '...',
resave: true,
saveUninitialized: true
});
const session = KoaSession(CONFIG, app);
app.use(session);
app.use( ... );
// init koa-socket-session as koa-socket's middleware
io.use(koaSocketSession(app, session));
io.on( 'message', ( ctx, data ) => {
// get username from session
let username = ctx.session.username;
// print the message received and username in session
console.log( `message: ${ data }, username: ${username}` )
});
let server = http.createServer(app.callback());
io.start(server);
app.use(function *() {
// set username in session to 'LnsooXD'
this.session.username = 'LnsooXD'
this.body = 'Hello World';
});
server.listen(3000);
##Authors
FAQs
Middleware for koa-socket session support
We found that koa-socket-session demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

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.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.

Security News
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.