peers / peerjs-server

Server for PeerJS
https://peerjs.com
MIT License
4.34k stars 1.08k forks source link

migrate from localhost to shared hosting #321

Closed veeyka closed 1 year ago

veeyka commented 1 year ago

hi . peer server and peerjs client is working well on my localhost . i brought it on my shared hosting . now i have problem connecting to peer server after uploading it to my host . its 2 days im chaning options on both server and client side and got nothing . i made a subdomain in my host for peer server for runing express . i think my problem is that host dont start my server with port 9000 which i have set .

its my server address . when you click it its says peer server is working as it have to be . https://node2.bonyadonline.com/peer-server

--------- my server code is :

const express = require('express');
const fs = require("fs");
const app = express();
const { ExpressPeerServer } = require('peer');
const cors = require("cors");
app.use(cors());

const server2 = app.listen(9000);

const peerServer = ExpressPeerServer(server2, {
  debug: true,
  allow_discovery: true,
  ssl: {
    key: fs.readFileSync('./keyname.key'),
    cert: fs.readFileSync('./cername.cer')
    }
});

app.use("/peer-server",peerServer);

---------- and my client code is :

const peer = new Peer(undefined,{
  secure:true,
  key:"peerjs",
  host: "node2.bonyadonline.com",
  port: "9000",
  path: '/peer-server',
});

could you please help me . thanks