I have a custom sails.js hook which implements a Websocket server (we can't use the built-in socket.js
hook because we needed to match an old API).
I also have a custom sails run
script that does background processing.
Right now, when the sails run -name-of-my-script
command is run, it also runs my hook which makes extra listeners for all of the events used by this hook.
I would like to make it that the hook only starts on a main application startup (sails lift
or the equivalent node app.js
), not on sails run ...
.
I have looked through the code and the documentation, but I can't seem to see any official way to do this.
I can think of two options:
- In the hook, check for whether a script is being run and don't initialize.
- In the script, disable the hook.
Is there any way to do either of those things?