socket.io try to listen to default apache port - node.js

In my Node.js script, I set socket.io to listen on port 8080:
client = require('socket.io').listen(8080).sockets);
Then I can connect with io.connect('http://.../8080').
But why, in the firefox/chrome consoles, I see multiple GET requests on port 80?
Like these :
GET http://.../socket.io/?EIO=2&transport=polling&t=1408319587655-58
GET http://.../socket.io/?EIO=2&transport=polling&t=1408319592695-59
GET http://.../socket.io/?EIO=2&transport=polling&t=1408319597750-60
Those links are working with port 8080.

Shouldn't it be io.connect('http://...:8080') and not io.connect('http://.../8080') ?

Related

I can't listen express server on port 80

I'm trying to create an express server using node.js but when I start the server on port 80 my friends can't use it. I can select any other port and it will work, but when I try port 80 it doesn't work. I'm using https://www.yougetsignal.com/tools/open-ports/ and https://portchecker.co/check to check if the port is openned, I tried with 3000 and it work perfectly, but I need to get it working in port 80. I have already disabled my firewall and setup my DMZ host in the router.
I believe you are using windows as OS. In it the port 80 could be used as default port for some service. Please check the following -
Skype uses port 80 by default, you can change this in skype options > advanced > connection - and uncheck "use port 80"
Port 80 is the standard HTTP port, so to check which services are using you could run net stop http. It will list the services using port 80 and will ask to whether end them or not.
Port 80 could be occupied by IIS server. Please stop IIS and then re-run the node service.
Some SQL Server Reporting services also use port 80

Don't see nodeJs serveur port working / same port client/server don't cause error

I have an application which work with React/socket/nodeJS on a VPS.
This VPS use apache as php engine and when I check the config, it listens the port 7080.
My nodeJS work on any port 80 / 3000 / 7080 etc... and when I use netstat on my console VPS I don't see this <IP:SERVERPORT>.
Here is the problem I face:
1. Why I can't see my server PORT running on my VPS with netstats? ( I see console log from my server so he work)
2. Why it work with the same apache port? Normally I have to use a server port different from the client...
For information, my vps is dedibox (online.net with plesk).

how to allow access to port on AWS

I am trying to connect to my development port port 3000 on aws but it is not working. I have currently configured my domain with the instance and it is working fine but I cannot access port 3000 and get ERR_EMPTY_RESPONSE
The security group setting is as below
As you can see, I have opened up my mongo port 27017 and 3000 which is my node server port
As you can see here, it is listening at port 3000. I set it to print out the exact port that is being listened.
When I go netstat -natlp the following shows
port 3000 is currently listening.
I have followed all the instructions and suggestions but it is still not working for a weird reason. The server I use is Asia(Seoul) server.
Am I missing something here?

Node.js and Apache: connection issues

I have installed Node.js with Socket.io on a CentOS server which is running Apache on port 80.
I created a socket test, which justs listens on port 8080.
If I curl the address localhost:8080 from within the server's shell, I get the Socket.io-welcome message. If I have a line like this:
<script src="http://localhost:8080/socket.io/socket.io.js"></script>
Then the browser cannot find the file.
A "solution" was to proxy requests to /nodejs/ to http://localhost:8080/, but this solution did not work for very long.
Is it possible to run the Node.js server when we have Apache installed? Which settings must be changed in order for us to access the url: http://server.com:8080 ? It seems the Node.js only accepts connections from localhost.
Problem is most probably in your node.js program.
It should listen on 0.0.0.0 and not 127.0.0.1 which is local only.
So where you've got something like:
.listen(8080, '127.0.0.1'); // '127.0.0.1' or 'localhost'
You should change it to:
.listen(8080); // or 0.0.0.0
Apache will only interfere if it also uses port 8080 but you should get an error when starting your node app if this is the case.
Also, if you connect to http://localhost in your browser, it will only work if the server is on the same local machine as the browser. Fine for testing I guess.
You'll have to connect to a domain or ip address if you have a hosted server else no browser will find it.
Update:
Your socket.io code also needs to connect correctly:
var socket = io.connect('http://correct.server.com:8080'); // not localhost
and your browser needs to load the javascript file from the correct place:
<script src="http://correct.server.com/socket.io/socket.io.js"></script> // not localhost
This might help with firewall / load balancer issues:
https://github.com/LearnBoost/socket.io/wiki/Socket.IO-and-firewall-software

Can't configure node_chat to localhost

I went to configure server.js but I get the error connecting to server.
HOST=localhost;
PORT= 80;
http://github.com/ry/node_chat
Try using a different port. I believe node.js has some trouble listening on port 80

Resources