title: WebRTC TURN Server - I set it up, but it's not working
body: <p>I've set up a text chat service using the PeerJS implementation of WebRTC's data channel. PeerJS provides a basic signalling server for this purpose, but I have tried to replace that with STUN and TURN servers set up through XirSys (recommended by SimpleWebRTC, another WebRTC library). I haven't deployed to the web yet. </p>
  
  <p>Using Node to serve my static files locally, it will work on a local network (when I am sitting next to the person and they navigate to my ip/port in the browser), but will not work when connecting through different access points on the same network (i.e. at work, on opposite ends of the building).</p>
  
  <p>My hypothesis is that it's hitting a firewall, but still directing traffic to PeerJS' signalling server without falling back to the XirSys STUN and TURN servers I've tried to set up. Here's the code I'm working with:</p>
  
  <pre><code>var stun = {};
  var turn1 = {};
  var turn2 = {}; 
    $.ajax({
      type: "POST",
      dataType: "json",
      url: "https://api.xirsys.com/getIceServers",
      data: {
          ident: "myusername",
          secret: "long-alphanumeric-secret-key",
          domain: "www.adomain.com",
          application: "anapp",
          room: "aroom",
          secure: 1
      },
      success: function (data, status) {
          console.log(data);
          stun = data.d.iceServers[0];
          turn1 = data.d.iceServers[1];
          turn2 = data.d.iceServers[2];
      },
      async: false
  });
  
  var conn;
    // Connect to PeerJS, have server assign an ID instead of providing one
    var peerID = prompt('What would you like your screen name to be?');
    var peer = new Peer(
      peerID, 
      {key: 'mypeerjsserverkey', debug: true}, 
      {
      config: {'iceServers': [
          {url: stun.url},
          {url: turn1.url, credential: turn1.credential, username: turn1.username},
          {url: turn2.url, credential: turn2.credential, username: turn2.username}
        ]
      }
    });
  </code></pre>
  
  <p>NOTE: My ident, secret, domain, etc. obviously aren't accurately represented here. I don't think that's where my problem is.</p>
  
  <p>Any thoughts?</p>