If you are using Skylink Media Relay while only subscribing to the PeerJoined event, you will not note any 'sent stats' for peers due to the way Skylink Media Relay works.


Consider the following scenario where Skylink Media Relay is not in use.


Scenario A

No MCU/SFU

In this case, the total number of streams uploaded will be: 


( n ) x ( n-1 ) 


where n represents the total number of Peers. In this case, that would be 4 x 3 = 12.

Here, both the total peer connections and the number of streams will be 4.


Now, in the following scenario where Skylink Media Relay is in use, each peer sends streams directly to the MCU/SFU and not to the remote peers, as depicted below.


Scenario B

With MCU/SFU

In this case, the total number of streams uploaded will be:

 ( n ) x ( 1)


where n represents the total number of Peers passing streams through the MCU Peer. In this case, that would be 4 x 1 = 4  with the total peer connections being ('n' + The MCU Peer).

In this case, the total number of streams uploaded will be 5.


To retrieve sent stats from the MCU peer, you can subscribe to the ServerPeerJoined event.


For Example:


var mcuStatInterval = null;
var mcuPeerId = null;
skylink.on('serverPeerJoined', function (peerId, serverPeerType) {
if (serverPeerType === 'MCU') {
mcuPeerId = peerId;
mcuStatInterval = setInterval(function () {
skylink.getConnectionStatus(peerId, function (err, stats) {
if (stats && stats.peerStats[peerId]) {
console.info(stats.peerStats[peerId])
}
});
}, 1000);
}
});
skylink.on('peerLeft', function (peerId) {
if (peerId === mcuPeerId && mcuStatInterval) {
clearInterval(mcuStatInterval)
}
});