openvidu-server: KMS methods to get the number of sessions and webrtc connections

pull/609/head
pabloFuente 2021-02-05 14:07:46 +01:00
parent ff35adf607
commit fe03ee96ce
2 changed files with 10 additions and 0 deletions

View File

@ -345,4 +345,9 @@ public class KurentoSession extends Session {
return json; return json;
} }
public int getNumberOfWebrtcConnections() {
return this.getActivePublishers() + this.participants.values().stream()
.mapToInt(p -> ((KurentoParticipant) p).getSubscribers().size()).reduce(0, Integer::sum);
}
} }

View File

@ -250,4 +250,9 @@ public class Kms {
return this.uri; return this.uri;
} }
public int getNumberOfWebrtcConnections() {
return this.kurentoSessions.values().stream().mapToInt(session -> session.getNumberOfWebrtcConnections())
.reduce(0, Integer::sum);
}
} }