Here's a snippet of my app.js:
var
express = require('express'),
app = express(),
server = require('http').createServer(app),
io = require('socket.io').listen(server),
server.listen(process.env.PORT || 80);
io.sockets.on('connection', function (socket) {
console.log("socket connected");
socket.emit('connection', { hello: 'from domain' });
socket.on('hello', function (data) {
console.log(data);
});
socket.on('subscribe', function (data) {
console.log('subscribe');
sendemail.subscribe(socket, data);
});
socket.on('register', function (data) {
console.log('register');
sendemail.register(socket, data);
});
});
I have 2 listeners, one for subscribe and one for register.
When I open the console log in my browser I can see the hello socket emit, however the subscribe and register do not work (so basically any information from my browser to the server does not work, but anything from the server to my browser works fine).
This behavior happens when I run both the socket and the server on port 80, when I change either the socket port or both to 81 everything works just fine.
I visited http://websocketstest.com/ and I don't see any issues so I'm guessing it's nothing on my end but maybe on my host's end (Hosting at linode.com).
I've contacted them and they said that they do not block any form of traffic and their servers have no firewalls in front of them or anything like that.
I have iptables disabled on the server and SELinux is also disabled so I'm not sure what is going on (as i've said, if I simply change the port to 81 everything works fine).