A module performing device-to-module communications for gridapps
Returns a (type: string, payload: any) => void
function, that could be used to broadcast messages to modules.
Example:
import {usePublish} from '@phygrid/edge-messaging';
export default App = () => {
const publish = usePublish();
const handleClick = useCallback(() => {
publish('Test.ping', {hello: 'world'});
}, [publish])
return <button onClick={handleClick}>pub</button>
}
Subscribes to a certain message type.
Returns message bus connection status
Sends heartbeats to GridOS, indicating that app is alive.