Nodejs + socket.io + Apache

Hi,

I installed nodejs via the virtualmin interface under public_html/nodejs and I use socket.io. But I cannot get socket.io to work and I believe there is some issues with the Apache proxy that I need to configure. Here is what I have

server.js
var serverPort =3003
var http = require(‘http’);
var fs = require(‘fs’);
var server = http.createServer(function (req, res) {
fs.readFile(‘index.html’, function(err, data) {
res.writeHead(200, {‘Content-Type’: ‘text/html’});
res.write(data);
return res.end();
});
})
server.listen(serverPort, ‘127.0.0.1’);
var io = require(‘socket.io’)(server);
io.on(‘connection’, function(socket) {
console.log(‘new connection’);
socket.emit(‘message’, ‘This is a message from the dark side.’);
});

index.html (interalia)

Both index.html and server.js are in public_html/nodejs

This works on my local, obviously not here. This is the last message I had on the browser console:
[Error] Failed to load resource: The request timed out. (socket.io, line 0)

Also the proxy configuration in https.conf
<Proxy balancer://mongrel3003>
BalancerMember http://localhost:3003

ProxyPass /nodejs balancer://mongrel3003

Any idea of what I should do?

Many thanks,

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.