Settings page

This commit is contained in:
2023-01-09 11:00:23 +00:00
parent 6c157019ea
commit 276a4cbcd1
12 changed files with 284 additions and 221 deletions

View File

@ -4,6 +4,16 @@ import { Subscriptions } from "./Subscriptions";
import Event from "./Event";
import { DefaultConnectTimeout } from "../Const";
export class ConnectionStats {
constructor() {
this.Latency = [];
this.Subs = 0;
this.SubsTimeout = 0;
this.EventsReceived = 0;
this.EventsSent = 0;
}
}
export default class Connection {
constructor(addr, options) {
this.Address = addr;
@ -13,6 +23,7 @@ export default class Connection {
this.Read = options?.read || true;
this.Write = options?.write || true;
this.ConnectTimeout = DefaultConnectTimeout;
this.Stats = new ConnectionStats();
this.Connect();
}
@ -145,6 +156,7 @@ export default class Connection {
_OnEvent(subId, ev) {
if (this.Subscriptions[subId]) {
//this._VerifySig(ev);
ev.relay = this.Address; // tag event with relay
this.Subscriptions[subId].OnEvent(ev);
} else {
// console.warn(`No subscription for event! ${subId}`);