Mobile app version of vmapp.org
Login or Join
Bryan171

: How do I disable socket.io cookie named io server-side? I needed to disable the socket.io cookie named io server-side. I follow the path to file creating the cookie to a file located at C:socket.ioexampleschatnode_modules

@Bryan171

Posted in: #Cookie #NodeJs #Server

I needed to disable the socket.io cookie named io server-side.
I follow the path to file creating the cookie to a file located at
C:socket.ioexampleschatnode_modulessocket.ionode_modulesengine.iolibserver.js
Which lines do I need to remove?

10.02% popularity Vote Up Vote Down


Login to follow query

More posts by @Bryan171

2 Comments

Sorted by latest first Latest Oldest Best

 

@Sarah324

Just pass an option to do it:

var io = require('socket.io')();
io.on('connection', function(client){});
io.listen(3000, {
cookie: false
});


See it in the docs: github.com/socketio/engine.io#methods-1

10% popularity Vote Up Vote Down


 

@Bryan171

I removed the lines below and it removed the cookie
line 14
//var cookieMod = require('cookie');
line 47
//this.cookie = false !== opts.cookie ? (opts.cookie || 'io') : false;
line 48
//this.cookiePath = false !== opts.cookiePath ? (opts.cookiePath || '/') : false;
line 49
//this.cookieHttpOnly = false !== opts.cookieHttpOnly;
line 290 - line 298
//if (false !== this.cookie) {
//transport.on('headers', function (headers) {
//headers['Set-Cookie'] = cookieMod.serialize(self.cookie, id,
//{
//path: self.cookiePath,
//httpOnly: self.cookiePath ? self.cookieHttpOnly : false
//});
//});
//}

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme