samedi 27 décembre 2014

ERR_CONNECTION_REFUSED with socket.io on Node.js server


I have a basic client-server setup with Node.js:


Server



var port = 8000;
var http = require('http');
var express = require('express');
var app = express();
var server = http.createServer(app).listen(port);
var io = require('socket.io').listen(server);

app.use(express.static(__dirname + '/site'));
app.get('/', function(req, res) {
res.sendFile(__dirname + '/site/index.html');
});

server.listen(port, function() {
console.log("Listening on port " + port + "...");
});

io.on('connection', function(socket) {
console.log("A user connected");
});


Client



var socket = io.connect("http://72.53.66.228:8000");

socket.on('connect', function() {
console.log("Connected.");
});


However, I keep getting this error in my browser, and I'm not sure why:



GET http://72.53.66.228:8000/socket.io/?EIO=3&transport=polling&t=1419738402131-5 net::ERR_CONNECTION_REFUSED


I should also note that I'm running an Apache webserver and I'm using the ProxyPass directive to let Node.js serve off a subdirectory





Aucun commentaire:

Enregistrer un commentaire