@ombori/ga-messaging
v4.1.27
Published
A module performing device-to-module communications for grid apps
Downloads
86
Maintainers
Keywords
Readme
GridApp Messaging
A module performing device-to-module communications for grid apps
Hooks
usePublish()
Returns a (type: string, payload: any) => void
function, that could be used to broadcast messages to modules.
Example:
import {usePublish} from '@ombori/ga-messaging';
export default App = () => {
const publish = usePublish();
const handleClick = useCallback(() => {
publish('Test.ping', {hello: 'world'});
}, [publish])
return <button onClick={handleClick}>pub</button>
}
useSubscribe(type: string, callback: (msg: any) => void, deps: any[]);
Subscribes to a certain message type.
useStatus(): boolean
Returns message bus connection status
useHeartbeat(): void
Sends heartbeats to GridOS, indicating that app is alive.