3

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.io\examples\chat\node_modules\socket.io\node_modules\engine.io\lib\server.js
Which lines do I need to remove?

3

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 //}); //}); //}

2

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: https://github.com/socketio/engine.io#methods-1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.