1
0
mirror of https://gitlab.crans.org/nounous/ghostream.git synced 2025-06-27 23:52:16 +02:00

Get stats by a bad but functionnal way

This commit is contained in:
Yohann D'ANELLO
2020-11-09 17:57:55 +01:00
parent 6ca354f44f
commit b2104a0cb7
2 changed files with 28 additions and 6 deletions

View File

@ -9,6 +9,7 @@ export class ViewerCounter {
constructor(element, streamName) {
this.element = element;
this.url = "/_stats/" + streamName;
this.uid = Math.floor(1e19 * Math.random()).toString(16);
}
/**
@ -21,7 +22,7 @@ export class ViewerCounter {
}
refreshViewersCounter() {
fetch(this.url)
fetch(this.url + "?uid=" + this.uid)
.then(response => response.json())
.then((data) => this.element.innerText = data.ConnectedViewers)
.catch(console.log);