Skip to content
For the complete documentation index, see llms.txt. This page is also available as Markdown.

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.

When real-time is on, the host fires onData again on every tick, with the same shape. React to onData; never open a WebSocket or poll yourself.

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?