@lucasschirm/amb-client-react
v0.0.3
Published
Allow to watch records using AMB Websockets from a react application.
Maintainers
Readme
Simple package that allow you to use the servicenow AMB service on your react application.
Usage
To install run the command below on the react app folder
npm install @lucasschirm/amb-client-reactTo use it on your react component just import and use it like the example below.
import useAMB, { encodeQuery } from "@lucasschirm/amb-client-react";
export default function MyComponent() {
const amb = useAMB();
useEffect(() => {
const unsubscribe = amb.subscribe(
"/rw/default/incident/" + encodeQuery("is_active=1"),
(message) => {
console.log(`Record changed: `, message);
}
);
return () => unsubscribe();
}, []);
}