Delaying sockets start
-
How can I delay the sockets start?
I found this code block on start.js:function (next) { var webserver = require('./webserver'); require('./socket.io').init(webserver.server); if (nconf.get('runJobs')) { require('./notifications').startJobs(); require('./user').startJobs(); } webserver.listen(next); }
All I want to obtain is to run the server first and 1-3 seconds later to start the sockets.
What I don't want is to rewrite in the src folder.Alternatively I could overwrite in a plugin the
Sockets.init
function.
What do you suggest? -
Why do you want to? Perhaps there is an alternative solution.
-
@PitaJ NodeBB is installed on a server and I'm using a proxy to serve it.
Both servers are on Heroku on free Dynos. If nodeBB is sleeping, the proxy server will wake it up, but when it starts it throws a socket error and the proxy server displays the "Application error" page.
But in reality NodeBB server started okay. -
It looks like is a configuration problem. When I load the page, there is this network error:
socket.io.js:8 WebSocket connection to 'wss://example.com/socket.io/?EIO=3&transport=websocket&sid=zV8kYkx-87ULGIjGAAAF' failed: Error in connection establishment: net::ERR_SSL_PROTOCOL_ERROR
On Chrome's inspector window it says it was canceled.
But then it works normal.
So all I need is to bypass the first error... or even better, fix it.