I\'ve been trying to figure this out for a while. I\'m trying to establish a simple connection using peerjs. I can connect successfully to the peer with id USER_ID
I had the exact same issue. Adding the STUN TURN servers should resolve the issue.
Client Side Code
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
});
Server Side code
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'));
});