14 lines
349 B
TypeScript
14 lines
349 B
TypeScript
"use client";
|
|
|
|
import { useEffect } from "react";
|
|
import { getWebSocketClient } from "@/lib/ws/connection";
|
|
|
|
export function useSystemMetricsSubscription(enabled: boolean) {
|
|
useEffect(() => {
|
|
if (!enabled) return;
|
|
const client = getWebSocketClient();
|
|
if (!client) return;
|
|
return client.subscribeSystemMetrics();
|
|
}, [enabled]);
|
|
}
|