Muhammad Raihan Muhaimin
Muhammad Raihan Muhaimin

Reputation: 5729

Getting rid of session and socket pooling sailsjs

Hi I am current working on my rest api app using sails. I was reading the following article http://engineering.linkedin.com/nodejs/blazing-fast-nodejs-10-performance-tips-linkedin-mobile

In point 2 it was suggested to get rid of socket pooling

var http = require('http');
var options = {.....};
options.agent = false;
var req = http.request(options)

and in point 7 it suggest to get rid of session by removing.

app.use(express.session({ secret: "keyboard cat" }));

I am wondering how I can do that in sails.

Upvotes: 2

Views: 1668

Answers (2)

Leo
Leo

Reputation: 3872

For Sails v0.11x, you should use the recommended approach of editing .sailsrc file, and setting:

{
   "hooks": {
        "session": false,
        // also useful when building an API
        "grunt": false,
   }
}

Upvotes: 5

sgress454
sgress454

Reputation: 24948

In Sails.js v0.10 you can disable the session by adding the following key to your config/express.js file:

middleware: {
   session: null
}

As far as socket pooling goes, I think they're talking about making http requests from the server, and just suggesting that when making such requests, you set the agent option to false.

Upvotes: 3

Related Questions