peers / peerjs

Simple peer-to-peer with WebRTC.
https://peerjs.com
MIT License
12.33k stars 1.43k forks source link

Amazon EC2 connectivity issues #690

Open githubMoko opened 4 years ago

githubMoko commented 4 years ago

I've got an EC2 istance running the peer signaling service on port 9000. I have 2 client let's say A and B that connects with fixed IDs to the server. The clients connects to the server (i saw the logs), but when i launch "peer.connect('A');" nothing happens. If i move the signalling server to my local machine everything works. I tried to add the google STUN server to the config like this:

const peer = new Peer('A', { config: {'iceServers': [{ 'urls': 'stun:stun.l.google.com:19302' }]}, host: 'ec2-15-23...compute.amazonaws.com', port: 9000, path: '/' })

But nothing changed. Do i miss something?

githubMoko commented 4 years ago

UPDATE : i managed to subscribe to a free stun/turn service and added them to the peer config. When the second client (B) connects to the first one (A) i saw those lines in the console: ... PeerJS: Server message received: {type: "CANDIDATE", src: "B", dst: "A", payload: {…}} ...

on B client side I send a string to the client A, but there this line are never triggered: peer.on('connection', (conn) => { console.log("Connected to: " + conn.peer);

  conn.on('open',function(){
    conn.on('data', function(data) {
        console.log('Received', data);

...

emaciel10 commented 2 years ago

@githubMoko any update on whether you ever got this working on an ec2 instance in aws?