From 06e6c17b7b2b1e9d368ca51b505bdfe86e390b42 Mon Sep 17 00:00:00 2001 From: Your Name Date: Wed, 25 Feb 2026 07:18:42 -0400 Subject: [PATCH] v1.2.45 - Add WebSocket Connections to system status: api.c sends active_connections, HTML+JS display it --- api/index.html | 4 ++++ api/index.js | 3 +++ src/api.c | 4 ++++ src/main.h | 4 ++-- 4 files changed, 13 insertions(+), 2 deletions(-) diff --git a/api/index.html b/api/index.html index 0e12986..ab3e9fa 100644 --- a/api/index.html +++ b/api/index.html @@ -112,6 +112,10 @@ Process ID - + + WebSocket Connections + - + Active Subscriptions - diff --git a/api/index.js b/api/index.js index cfedeb5..9acd039 100644 --- a/api/index.js +++ b/api/index.js @@ -4492,6 +4492,9 @@ function updateStatsFromCpuMonitoringEvent(monitoringData) { if (monitoringData.process_id !== undefined) { updateStatsCell('process-id', monitoringData.process_id.toString()); } + if (monitoringData.active_connections !== undefined) { + updateStatsCell('websocket-connections', monitoringData.active_connections.toString()); + } if (monitoringData.memory_usage_mb !== undefined) { updateStatsCell('memory-usage', monitoringData.memory_usage_mb.toFixed(1) + ' MB'); diff --git a/src/api.c b/src/api.c index 427bf6e..1ad66d1 100644 --- a/src/api.c +++ b/src/api.c @@ -1291,6 +1291,10 @@ cJSON* query_cpu_metrics(void) { pid_t pid = getpid(); cJSON_AddNumberToObject(cpu_stats, "process_id", (double)pid); + // Get active WebSocket connection count + extern int g_connection_count; + cJSON_AddNumberToObject(cpu_stats, "active_connections", (double)g_connection_count); + // Get memory usage from /proc/self/status FILE* mem_stat = fopen("/proc/self/status", "r"); if (mem_stat) { diff --git a/src/main.h b/src/main.h index 552137b..3a4dd57 100644 --- a/src/main.h +++ b/src/main.h @@ -13,8 +13,8 @@ // Using CRELAY_ prefix to avoid conflicts with nostr_core_lib VERSION macros #define CRELAY_VERSION_MAJOR 1 #define CRELAY_VERSION_MINOR 2 -#define CRELAY_VERSION_PATCH 44 -#define CRELAY_VERSION "v1.2.44" +#define CRELAY_VERSION_PATCH 45 +#define CRELAY_VERSION "v1.2.45" // Relay metadata (authoritative source for NIP-11 information) #define RELAY_NAME "C-Relay"