Hello,
We are trying to set up Live Update on our scheduler. We want to run nodejs using pm2 so that we don’t have to access the ip address directly and also for monitoring.
We are able to start server.js just by running “node server.js” and our scheduler works. Once we start it with pm2 and try to access it not by the ip but the actual url, it keeps giving 504 errors. It seems that in order to have pm2 work, we need some sort of http response to satisfy the proxy:
ex;
var server = http.createServer(function(request, response) {
response.writeHead(200, {'Content-Type': 'text/plain'});
response.end('Hello');
});
However, when I add that, it just prints out “hello” and we lose the sync functionality.
This is what our server.js looks like:
[code]var http = require(‘http’);
var faye = require(“faye”);
var sys = require(‘sys’);
var server = http.createServer(function(req, res){});
var bayeux = new faye.NodeAdapter({mount: ‘/sync’, timeout: 45 });
bayeux.attach(server);
bayeux.getClient().subscribe(‘/broadcast’, function(data) {
bayeux.getClient().publish(‘/update’, data);
});
server.listen(8082, ‘xx.xxx.x.xx’); //real ip not displayed
sys.puts(‘Server running’);[/code]
Looking at nginx.com/blog/websocket-nginx/, it seems to use slightly different code…
var WebSocketServer = require('ws').Server
Do you have any suggestions for how we can get Live Update up and running like this?
Thanks!