Files
@ ac55319a2eac
Branch filter:
Location: light9/web/collector/CollectorClient.ts - annotation
ac55319a2eac
706 B
video/MP2T
don't drop patches that arrive before we get WS connected
ae4b90efb55a ae4b90efb55a ae4b90efb55a ae4b90efb55a ae4b90efb55a ae4b90efb55a ae4b90efb55a ae4b90efb55a ae4b90efb55a ae4b90efb55a ae4b90efb55a ae4b90efb55a ae4b90efb55a ae4b90efb55a ae4b90efb55a ae4b90efb55a ae4b90efb55a ae4b90efb55a ae4b90efb55a ae4b90efb55a ae4b90efb55a ae4b90efb55a ae4b90efb55a ae4b90efb55a ae4b90efb55a ae4b90efb55a ae4b90efb55a ae4b90efb55a ae4b90efb55a ae4b90efb55a | type Settings = Array<[string,string,string|number]>;
export class CollectorClient {
private settings: Settings;
constructor(public clientName:string) {
this.settings = [];
this.putLoop();
}
private async putLoop() {
await this.put();
setTimeout(() => {
this.putLoop();
}, 1000);
}
private async put() {
await fetch("/service/collector/attrs", {
method: "PUT",
body: JSON.stringify({
client: this.clientName,
clientSession: "unused",
sendTime: Date.now() / 1000,
settings: this.settings,
}),
});
}
public async updateSettings(settings: Settings) {
this.settings = settings;
await this.put()
}
}
|