15c0c35df6
Co-authored-by: Carlos Florencio <carlosmflorencio@gmail.com>
14 lines
342 B
TypeScript
14 lines
342 B
TypeScript
"use client";
|
|
|
|
import { useEffect } from "react";
|
|
import { useWebSocketClient } from "@/lib/ws/connection";
|
|
|
|
export function useSystemMetricsSubscription(enabled: boolean) {
|
|
const client = useWebSocketClient();
|
|
|
|
useEffect(() => {
|
|
if (!enabled || !client) return;
|
|
return client.subscribeSystemMetrics();
|
|
}, [client, enabled]);
|
|
}
|