Real-time
Read the dashboard's real-time status and turn it on or off from a Custom Metric widget — useUbidotsRealTimeStatus and setRealTime
GET
useUbidotsRealTimeStatus() returns boolean | null. It is null until the host reports the status.
EMIT (useUbidotsActions())
setRealTime(true | false)
How to implement: a real-time toggle
import { useUbidotsRealTimeStatus, useUbidotsActions } from '@ubidots/react-html-canvas';
function RealTimeToggle() {
const rt = useUbidotsRealTimeStatus();
const { setRealTime } = useUbidotsActions();
return <button onClick={() => setRealTime(!rt)}>{rt ? 'Live' : 'Paused'}</button>;
}Last updated
Was this helpful?