'How to Use a Different Port on Peer.js Server
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.
Solution 1:[1]
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
Solution 2:[2]
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.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | lnogueir |
| Solution 2 | Jasper |
