Replies: 0 comments 4 replies
-
I think they have some problems with multi-stage builds. But the following works: Create an empty Github repository and put there a FROM peerjs/peerjs-server:1.0.0 Then connect with const peer = new Peer(id, {host: "mypeerjsserver6-xxxxxx.b4a.run", port: 443, secure: true}); Footnotes
|
Beta Was this translation helpful? Give feedback.
-
Hi jonasgloning. Your answers gets a long way, but still does not work. I have done what you have said with the Dockerfile. Back4App then gives a url, eg "https://mypeerjsserver10-XXXXX.b4a.run". The XXXXX are my user name. This url gives the correct response: {"name":"PeerJS Server","description":"A server side element to broker connections between PeerJS clients.","website":"https://peerjs.com/"} How do I connect to this Back4App server from my javascript client code? I thought it would be: const peer = new Peer(id, {host: "mypeerjsserver10-XXXXX.b4a.run", port: 443, secure: true}); But this does not connect. Is it the host, port or secure? Do I need a path? If so, what path? If you want to try this, it is simple to set up. What I have done: Setting Up Your Own Github PeerJS Server Repository So set up an empty Github project with just a Dockerfile with the single line contents: FROM peerjs/peerjs-server:1.0.0 Setting Up Your Back4App Container Back4App has made this very simple as they process this with the Dockerfile in your Github repository.
When it loads everything, in the top left you will get a green tick and the word 'Available'. Underneath will be your url for the app, eg mypeerjsserver10-XXXXX.b4a.run. If you click on that url you will direct to a webpage with the following: {"name":"PeerJS Server","description":"A server side element to broker connections between PeerJS clients.","website":"https://peerjs.com/"} So it is all working. Note the url is an https so it is secure. Testing the PeerJS Container There is a Jsfiddle by someone else. https://jsfiddle.net/NathanFriend/q6tch0az/39/ He uses the general server run by the PeerJS creators. He connects to that with the line: const peer = new Peer(id); To connect it to your server, you have to edit this line to something like: const peer = new Peer(id, {host: "mypeerjsserver10-XXXXX.b4a.run", port: 443, secure: true}); But this obviously does not work. I am close, but still a long way off. |
Beta Was this translation helpful? Give feedback.
-
PeerJS Server was working on Back4App where you could get the message, but now even that has stopped working with the new DockerFile.
Back4App uses the Dockerfile to set up.
What I have done.
Once it becomes active, you get a url, eg 'mypeerjsserver6-xxxxxx.b4a.run'.
If you type this into your browser, you used to get your response message and everything was working fine.
Now we do not even get that.
That is the finish of the issue, however while it was working I could not work out the following:
I just cannot connect to my Back4App PeerJS Server in Client Code.
You can use a third-party code to test:
https://jsfiddle.net/NathanFriend/q6tch0az/39/
The line that connects is:
const peer = new Peer(id);
However, this only connects to the general server run by PeerJS. To connect it to my server, you have to edit this line to:
const peer = new Peer(id, {host: "mypeerjsserver6-xxxxxx.b4a.run", port: 443, secure: true});
I think the port has to be 443 because back4app is a secure host. I think I have the host field set correctly.
Do I need to do edits in the dockerfile to address the possible 443 port? How do I do that in Github?
I am so close, but so far away.
Beta Was this translation helpful? Give feedback.
All reactions