Learn how to use ambient events in the Suki Assistant SDK to track and manage ambient interactions.
import { SukiAssistant, SukiProvider, useSuki } from "@suki-sdk/react";
function MyComponent() {
const { on, activeAmbientId } = useSuki();
useEffect(() => {
const handleAmbientUpdate = (event) => {
console.log("Ambient event received:", event);
};
// Subscribe to ambient update events
const unsubscribe = on("ambient-update", handleAmbientUpdate);
// Cleanup subscription on unmount
return () => {
unsubscribe();
};
}, [on]);
return (
<>
Active Ambient ID: {activeAmbientId}
<SukiAssistant
// props
/>
</>
);
}