Closed antonky closed 4 years ago
@nakamin please provide your server side code
Sure, here's the code:
import * as http from "http";
import express from "express";
import { ExpressPeerServer } from "peer";
const app = express();
const server = http.createServer(app);
// peerjs
const peerServer = ExpressPeerServer(server, {
proxied: true,
path: "/"
});
app.use("/peerjs", peerServer);
const PORT = process.env.PORT || 5000;
server.listen(PORT);
My app is deployed on Heroku, peerjs endpoint works: https://synctune.herokuapp.com/peerjs The id endpoint does not https://synctune.herokuapp.com/peerjs/id
Adding the key in between makes it work: https://synctune.herokuapp.com/peerjs/hello/id
Also I'm having an issue with the peer server itself, when I try to connect I get this error:
https://github.com/peers/peerjs-server/blob/master/src/api/README.md
From README:
GET
/:key/id
- return a new user id. required :key
from config.
Which version of peer
did you use? Try to use the latest 0.5.2
I just deployed the peer server separately, it works now 🤷♂️
I set up the peer server and the id endpoint doesn't work as shown on the README The README states
This actually 404s I looked at your code, and the route to get the random id is
http://127.0.0.1:9000/myapp/peerjs/<literally anything you want>/id
So between /peerjs/ and /id/ theres a param called:key
which never gets used in your code, but it is required to get an id So how am I supposed to use this with the PeerJS library? Since it will make a request to127.0.0.1:9000/myapp/peerjs/id