How to change "mediasoup" port - node.js

I installed mediasoup and ran it as well!
But it's working on 3000 port.
I couldn't find listen port in its sources, How i can change this port to443?

Actually you did not install mediasoup but the mediasoup-demo which, indeed, includes a WebSocket based signaling protocol that listens in port 3000.
mediasoup-demo it's just a demo, not an application or product.

If you need to listen bellow than 1024 port then you need to run as administrator on windows and as a root(sudo) user on Linux/MAC that is sudo node server.js
and as documentation of https://github.com/versatica/mediasoup-demo, you must update port on config.js
protoo :
{
listenIp : '0.0.0.0',
listenPort : 443
},

Related

Trouble conecting to Node Server on EC2 Instance

I have a Node application running on an EC2 instance, and after npm start, I am unable to connect to the application via the web, but everything indicates that it is running correctly.
Here's how my server.js looks like:
app.listen(8000,"0.0.0.0", () => {
console.log("app running on port 8000");
});
How are the inbound rules of the EC2 security group:
I saw on other sites that removing " 0.0.0.0. " From app.listen and leaving only the port would solve the problem, but unfortunately that didn't work.
Another thing I tried was to add a * Custom TCP * rule to port 8000 in the security group, but this prevented the application from running, saying that the port was already in use
Something is already listening on port 8000, a netstat should tell you what it is.
Simply add a TCP security group for port 8001 or 8080 and in your code use that port instead.

What else is required to access a node app from outside a Digital Ocean droplet?

We have set up a node server which runs on port 5000.
In a newly created droplet, we have installed and started nginx. To access the node app, we have changed the default port from 80 to 5000 in /etc/nginx/sites-enabled/default
server {
listen 5000 default_server;
listen [::]:5000 default_server;
ufw is enabled
sudo ufw enable
Also the port is enabled
sudo ufw allow 5000/tcp
Also, tried this way too:
sudo ufw allow 5000
As confirmed with sudo ufw status
netstat -ntlp
Also the app is configured to listen on the public interface
const server = app.listen(process.env.PORT || 5000, '0.0.0.0', () => {
console.log('Express server listening on port %d in %s mode', server.address().port, app.settings.env);
});
However, not even the default port was responding. Hence, we reverted to 80 as the default port.
What else is required to access node app outside of the droplet?
When it comes to NodeJS and NGINX, we'll want to configure NGINX to listen on port 80, though we'll want to use proxy_pass to pass the request from the web server (NGINX) to the NodeJS application on the port that the application is running on. This will allow us to keep the port out of the URL.
With the current configuration, NGINX would be listening on port 5000 which would prevent the application from being able to listen in on the same port (or vice versa).
There is an excellent guide that covers setting up NodeJS + NGINX -- this specific part is the most important:
https://www.digitalocean.com/community/tutorials/how-to-set-up-a-node-js-application-for-production-on-ubuntu-16-04#set-up-nginx-as-a-reverse-proxy-server
The above covers how we'd go about setting up the Server Block :-)

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-RED port number

Can we set port number of node-RED is same with another port number?
ex: test.js is running on 1880 port number, and then node-RED port number is 1880 too. but httpRoot will be actived,so when I run the node-RED, I use 127.0.0.1:1880/red. Is it possible?
Thank you
No, two applications can not share a port like this directly.
You could use something like nginx running on port 1880 and run test.js and Node-RED on different ports and have nginx proxy requests to the separate applications.
Or you could look at the documentation for embedding Node-RED and include Node-RED into your test.js application.
Actually Im pretty sure you can, if you are listening on different interfaces.
So for example if you listen on eth0 port 80 for incoming requests to a program you could listen on port 80 on localhost (or eth2) for another program.
So if you can constrain the socket of both applications to listen on a specific (different) interface it will be ok.
No. You cannot use that port for Node-RED if its already being used. Run Node-RED using the following command:
node-red -p 1881
This will start Node-RED on a new port (1881), so whenever you want to use a new port, use this command as you can start multiple Node-RED services.

socket.io try to listen to default apache port

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') ?

Resources