Files
@ d1946cb32121
Branch filter:
Location: light9/web/collector/CollectorClient.ts - annotation
d1946cb32121
809 B
video/MP2T
bool support
62dc1b3644a0 62dc1b3644a0 62dc1b3644a0 ae4b90efb55a ae4b90efb55a ae4b90efb55a ae4b90efb55a ae4b90efb55a ae4b90efb55a ae4b90efb55a ae4b90efb55a ae4b90efb55a ae4b90efb55a ae4b90efb55a ae4b90efb55a ae4b90efb55a ae4b90efb55a 62dc1b3644a0 ae4b90efb55a ae4b90efb55a ae4b90efb55a ae4b90efb55a ae4b90efb55a ae4b90efb55a 62dc1b3644a0 ae4b90efb55a ae4b90efb55a ae4b90efb55a ae4b90efb55a ae4b90efb55a ae4b90efb55a ae4b90efb55a ae4b90efb55a | import { Literal, NamedNode } from "n3";
type Settings = Array<[NamedNode,NamedNode,Literal]>;
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() {
// todo: WS
await fetch("/service/collector/attrs", {
method: "PUT",
body: JSON.stringify({
client: this.clientName,
clientSession: "unused",
sendTime: Date.now() / 1000,
settings: this.settings.map(([d,da,v]) => [d.value,da.value,v.value])
}),
});
}
public async updateSettings(settings: Settings) {
this.settings = settings;
await this.put()
}
}
|