Question

I want to disable socket.io service, in this version of the development phase, I was not ready to use it, how should I configure?

Was it helpful?

Solution

To disable it on the server side do this: https://gist.github.com/mikermcneil/8911041

Then on the client side just remove the .js files that initialize it.

OTHER TIPS

For me "sockets":false in .sailsrc or sails/hooks.js is not working.

sails v0.12.13, node v7.4.0.

I simply added this to config/sockets.js

beforeConnect: function(handshake, cb) {
  return cb('socket connections not allowed!', false);
},

To disable in the client-side.

  1. Disable the loader of js/dependencies/sails.io.js
  2. Add this HTML configuration script into your layout.

<script src="/js/dependencies/sails.io.js"
  autoConnect="false"
  environment="production"
  headers='{ "x-csrf-token": "<%= typeof _csrf === 'undefined' ? _csrf : '' %>" }'>
</script>

Refered to the sails document here ˚

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top