Error peerjs / webrtc iceConnectionState

I have been trying to figure this out for a while. I am trying to establish a simple connection using peerjs. I can successfully connect to the peer with id USER_ID. However, they cannot contact me. When I try to connect, I get the following log.

iceConnectionStateeventually changes to failed, and data cannot be retrieved.

  • Application uses peerjs cloud server
  • I am using the latest version of Chrome. They tried to use the latest versions of Chrome and Firefox.
  • They disabled all firewalls.
  • Tried the chat example peerjs and it fails with the same error.

Any idea why this could happen here?

Any help appreciated!

peer.min.js: 1 PeerJS: Socket open
peer.min.js: 1 PeerJS: Creating RTCPeerConnection.
peer.min.js: 1 PeerJS: Listening for ICE candidates.
peer.min.js: 1 PeerJS: Listening for `negotiationneeded`
peer.min.js: 1 PeerJS: Listening for data channel
peer.min.js: 1 PeerJS: Listening for remote stream
peer.min.js: 1 PeerJS: Setting remote description RTCSessionDescription
peer.min.js: 1 PeerJS: Added ICE candidate for: USER_ID
peer.min.js: 1 PeerJS: Set remoteDescription: OFFER for: USER_ID
peer.min.js: 1 PeerJS: Created answer.
peer.min.js: 1 PeerJS: Set localDescription: answer for: USER_ID
peer.min.js: 1 PeerJS: Received ICE candidates for: USER_ID
peer.min.js: 1 PeerJS: Added ICE candidate for: USER_ID
peer.min.js: 1 PeerJS: Received ICE candidates for: USER_ID
peer.min.js: 1 PeerJS: Added ICE candidate for: USER_ID
peer.min.js: 1 PeerJS: Received ICE candidates for: USER_ID
peer.min.js: 1 PeerJS: iceConnectionState is disconnected, closing connections to USER_ID
+4
1

. STUN TURN .

peer = new Peer(this.api.currentUserValue().id+'-'+this.api.currentUserValue().first_name,{
                                                    host: 'localhost',
                                                    port: 8080,
                                                    path: '/api',
                                                    debug: 3,
                                                    config: { 'iceServers': [
                                                      { 'url': 'stun:stun.l.google.com:19302' },
                                                      { 'url': 'turn:numb.viagenie.ca',credential: 'xxxx', username:'xxxx@gmail.com'  } ] } // this is must for keeping the connection open
                                                      });

var express = require('express');
var app = express();
var server = require('http').createServer(app);
var io = require('socket.io')(server);
var expressPeerServer = require('peer').ExpressPeerServer;
var path = require('path');



app.set('port', (process.env.OPENSHIFT_NODEJS_PORT || "8080"));
app.set('host', (process.env.OPENSHIFT_NODEJS_IP || "127.0.0.1"));

app.use(express.static(path.join(__dirname, '/client')));
app.use('/api', expressPeerServer(server, {debug:true}));




server.listen(app.get('port'),app.get('host'),function(){
  console.log('Server running at %s:%s',app.get('host'),app.get('port'));
});
+1

Source: https://habr.com/ru/post/1621170/


All Articles