My webhost has said the port 9000 is not available for an install of Peer.js Server.
Peer.js:
https://peerjs.com/
Peer.js Server:
https://github.com/peers/peerjs-server
My webhost says, 'Only the standard ports, 80 for HTTP and 443 for HTTPS' are available.
Does that mean I cannot install Peer.js Server on my webhost website?
Do I have to change all the 9000 to 80? Is that possible when only port 80 is all I am allowed on my webhost website? (I am still in the early learning phase of Node.js and websites.)
The webhost is Winhost, the basic option, if that is important.
You can actually run a Peer.js server using Express and specify whatever port you'd like.
Try this:
const { ExpressPeerServer } = require('peer');
const express = require('express');
const app = express();
const expressPort = 9000;
const expressServer = app.listen(expressPort);
const peerServer = ExpressPeerServer(expressServer);
app.use('/peerjs', peerServer);
So you can hit the Peer.js server on the specified endpoint /peerjs
No, you will not be able to run it on 80/443. Those are already in use by your web server, Nginx/Apache. You should grab a minimal VPS (virtual private server) and use that to run your Peer.js server.
Related
I build sample project with grpc server.in vs every things is ok and my project nice worked.
dokcer-compose.yaml is :
version: '3.3'
services:
grpcService:
container_name: grpcserver
image: grpcImage
ports:
- "5003:5003" //client
- "5001:5001" //grpc server
restart: always
in project I set http://127.0.0.1:5001 for grpc server
and set http://127.0.0.1:5003 for client
I handle (grpc server worked with http)
when docker-compose up and call api ,get faild and grpc server not found , etc
you must change CreateHostBuilder to this code in program.cs Grpc Server
public static IHostBuilder CreateHostBuilder(string[] args) =>
Host.CreateDefaultBuilder(args)
.ConfigureWebHostDefaults(webBuilder =>
{
webBuilder.UseStartup<Startup>().ConfigureKestrel(options =>
{
options.Listen(IPAddress.Any, 5001, listenOptions =>
{
listenOptions.Protocols = HttpProtocols.Http2;
});
});
});
}
5001 is grpc Server Port.(change this port to your grpc server port)
It's not entirely clear from your question how your client and server are separated; I would usually expect to see 2 services in the Docker Compose file: one for the server and a second for the client.
It is probable (!) that your client is unable to connect to the server because you are using the loopback (127.0.0.1) address. Loopback is a short-circuit way to route traffic within a machine that may not use the machine's network stack. For this reason, loopback traffic is not exposed beyond the container and is thus inaccessible to your client.
It is better to use 0.0.0.0 as the server's address when you run (!) the server so that the server will be bound to the networking stack and can be used by the host and other services (containers). In your Docker Compose file, this service will be given the DNS name of grpcService (probably lowercase only!?) and can be accessed from another service running in the Docker Compose file (network) as grpcservice:5003.
NOTE With the Docker Compose file (and its network), the server will be bound to whatever port you run it as e.g. 5003. The ports: - "XXXX:5003" is redundant *unless you wish to access this service from the host machine (outside of the Docker Compose network) when it will be available on port XXXX.
I am new to node.js and am trying to get into the hang of actually using it. I am very familiar with JavaScript so the language itself is self-explanatory but the use of Node.js is quite different from the browser implementation.
I have my own remote virtual server and have installed Node and the Package Manager and everything works as expected. I am not exactly a server extraordinaire and have limited experience with the Terminal and Apache Configurations.
I can run my server using:
nodejs index.js
Which gives me: listening on *:3300 as expected.
I can then access my localhost from the terminal using: curl http://localhost:3300/ which gives me the response I expect.
Given that the website that links to my server is https://example.com, how do I allow this link to access: http://localhost:3300/ so that I can actually use my node server in production? For example, http://localhost:3300/ runs a Socket Server that I would like to use using Socket.io on https://example.com/chat.html with the JavaScript:
var socket = io.connect('http://localhost:3300/', {transports: ['websocket'], upgrade: false});
Ok, this question has nothing to do with nodeJS.
localhost is a hostname that means this computer. it's equivalent to 127.0.0.1 or whatever IP address you can refer to your computer.
After the double colon (:) you enter the port number.
So if you want to make an HTTP call to a web-server running on your server, you have to know what is the IP address of your server, or the domain name, and then you call it with the port number where the server is running.
For Instance, you would call https://example.com:3300/chat.html to make an HTTP call to a server running on example.com with port 3300.
Keep in mind, that you have to make sure with your firewall configuration, that the specific port is open for incoming HTTP requests.
Trying to put together a project running an express server and gulp, browsersync, nodemon and mongodb. However I seem to be an Error: listen EADDRINUSE when I add browsersync. Any idea how to do this?
This means you already have a program listening on the port you are trying to use. What port are you running your application on? Is it 3000? If so, stop all other programs you have running that are using that port and you'll be good to go.
Are you defining in the browser-sync configuration the port to use?
In that case, the port needs to be something different from the one (if any) defined from the proxy. This works in my setup:
gulp.task('browser-sync', ['nodemon'], function() {
browserSync.init(null, {
proxy: "http://localhost:3000",
browser: ['google chrome'],
port: 4000
});
});
As reference, the full gulpfile.js (that uses nodemon and browsersync) is here.
In my javascript I'm doing:
var socket = io.connect('https://socket.xxxxxxxxxxx.net?token=socket1');
And the url in the "network" tab of chrome reads as
"https://socket.xxxxxxxxx.net:3000/socket.io/1/?token=socket1&t=1394492903833"
And I get an ERR_CONNECTION_TIMED_OUT.
I think this is because it's appending port 300 to my url, when, on the server, there is nothing running on port 3000.
My environment is a node.js server running on my local machine, and serving files through express, if this matters
The fix for this is to explicitly add the correct port, in my case 443, to the connection url.
Like so
https://socket.xxxxxxxxx.net:443/socket.io/1/?token=socket1&t=1394492903833
I have an Apache server running with SSL enabled. Now I made a small chat which is using node.js and socket.io to transmit data. Using port 8080 on a none secured connection is working just fine, but when I try it on a SSL secured domain it is not working. I do not get how the whole setup should work since SSL is only working through port 443. Apache is already listining on port 443. On which port should socket.io listen?
I had to set the SSL certificates like
var fs = require('fs');
var options = {
key: fs.readFileSync('/etc/ssl/ebscerts/wildcard.my_example.com.no_pass.key'),
cert: fs.readFileSync('/etc/ssl/ebscerts/wildcard.my_example.com.crt'),
ca: fs.readFileSync('/etc/ssl/ebscerts/bundle.crt')
};
var app = require('https').createServer(options),
io = require('socket.io').listen(app);
app.listen(8080);
I found the solution on github