code: function getStats () {
          pc.getStats(function (res) {
              var items = [];
              var connectionType = {};
  
              res.result().forEach(function (result) {
                  var item = {};
                  result.names().forEach(function (name) {
                      item[name] = result.stat(name);
                  });
                  item.id = result.id;
                  item.type = result.type;
                  item.timestamp = result.timestamp;
  
                  if (item.type === 'googCandidatePair' && item.googActiveConnection === 'true') {
                      connectionType = {
                          local: {
                              candidateType: item.googLocalCandidateType,
                              ipAddress: item.googLocalAddress
                          },
                          remote: {
                              candidateType: item.googRemoteCandidateType,
                              ipAddress: item.googRemoteAddress
                          },
                          transport: item.googTransportType
                      };
  
                      return;
                  }
  
                  items.push(item);
              });
  
              traceStats(items);
              window._webdriverrtcTimeout = setTimeout(getStats.bind(window, items), interval);
  
              if (typeof cb === 'function') {
                  cb(connectionType);
                  cb = undefined;
              }
          });
      }
docs: get RTCStatsReports