Available from SDK 2.1.0
Knowing how much peers are connected to you and how much offload a single SDK instance is performing while you are integrating the SDK could be useful. It could as well be used to send data to third parties analytics.
The SDK exposes a stats method which could be used like the following on an initialized SDK instance:
var func stats(_ completion: (_ stats: [String : Any]?) -> ())
- (void)stats:(void(^)(NSDictionary<NSString *, id> *))completion;
The completion gives access to a dictionary containing the following keys:
cdn: Traffic downloaded from the CDN (cumulated bytes).
dna: Traffic downloaded from the DNA network (cumulated bytes).
upload: Traffic uploaded to the DNA network (cumulated bytes).
peers: Real time connected peers count.
status:Current SDK status
On top of the stats API exposed by the SDK, we created a view helper to help you integrate and understand Streamroot DNA™ faster. The StatsView will inform you about the different states of the SDK lifecycle and Streamroot metrics. The view looks like the following:
To add statsview, just call the corresponding method from the DNAClient instance:
[self.dnaClient displayStatsOnView: self.contentOverlayView];