diff options
| author | JP Dillingham <jp@dillingham.me> | 2026-06-14 14:33:24 -0500 |
|---|---|---|
| committer | JP Dillingham <jp@dillingham.me> | 2026-06-14 14:33:24 -0500 |
| commit | 86bab11ddbd008f236006ee49bde7de40106675c (patch) | |
| tree | 68b6dbdab4339d2f5acff22f27f79c3a152d4afe /src/slskd/Telemetry | |
| parent | 2112c69139df93bea9b005196627be0125bb737b (diff) | |
| download | slskd-86bab11ddbd008f236006ee49bde7de40106675c.tar.gz | |
stub the MetricsHub
Diffstat (limited to 'src/slskd/Telemetry')
| -rw-r--r-- | src/slskd/Telemetry/API/MetricsHub.cs | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/src/slskd/Telemetry/API/MetricsHub.cs b/src/slskd/Telemetry/API/MetricsHub.cs new file mode 100644 index 00000000..ff4a6eeb --- /dev/null +++ b/src/slskd/Telemetry/API/MetricsHub.cs @@ -0,0 +1,61 @@ +// <copyright file="MetricsHub.cs" company="JP Dillingham"> +// ▄▄▄▄ ▄▄▄▄ ▄▄▄▄ +// ▄▄▄▄▄▄█ █▄▄▄▄▄█ █▄▄▄▄▄█ █ +// █__ --█ █__ --█ ◄█ - █ +// █▄▄▄▄▄█▄▄█▄▄▄▄▄█▄▄█▄▄█▄▄▄▄▄█ +// ┍━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ━━━━ ━ ━┉ ┉ ┉ +// │ Copyright (c) JP Dillingham. +// │ +// │ This program is free software: you can redistribute it and/or modify +// │ it under the terms of the GNU Affero General Public License as published +// │ by the Free Software Foundation, version 3. +// │ +// │ This program is distributed in the hope that it will be useful, +// │ but WITHOUT ANY WARRANTY; without even the implied warranty of +// │ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// │ GNU Affero General Public License for more details. +// │ +// │ You should have received a copy of the GNU Affero General Public License +// │ along with this program. If not, see https://www.gnu.org/licenses/. +// │ +// │ This program is distributed with Additional Terms pursuant to Section 7 +// │ of the AGPLv3. See the LICENSE file in the root directory of this +// │ project for the complete terms and conditions. +// │ +// │ https://slskd.org +// │ +// ├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌ ╌ ╌╌╌╌ ╌ +// │ SPDX-FileCopyrightText: JP Dillingham +// │ SPDX-License-Identifier: AGPL-3.0-only +// ╰───────────────────────────────────────────╶──── ─ ─── ─ ── ──┈ ┈ +// </copyright> + +using System.Threading.Tasks; +using Microsoft.AspNetCore.SignalR; + +namespace slskd.Telemetry; + +public static class MetricsHubMethods +{ + public static readonly string TRANSFERS = nameof(TRANSFERS); +} + +public static class ApplicationHubExtensions +{ + public static Task BroadcastTransferMetrics(this IHubContext<MetricsHub> hub) + { + return hub.Clients.All.SendAsync(MetricsHubMethods.TRANSFERS, new { }); + } +} + +public class MetricsHub : Hub +{ + public MetricsHub() + { + } + + public override async Task OnConnectedAsync() + { + await Clients.Caller.SendAsync(MetricsHubMethods.TRANSFERS, new { }); + } +}
\ No newline at end of file |
