diff --git a/examples/bot-ready-signalling/client/react-native/src/App.js b/examples/bot-ready-signalling/client/react-native/src/App.js index 85b10bec4..5b9e439f9 100644 --- a/examples/bot-ready-signalling/client/react-native/src/App.js +++ b/examples/bot-ready-signalling/client/react-native/src/App.js @@ -30,7 +30,26 @@ const CallScreen = () => { setIsConnected(false); log('Client disconnected'); }); + callObject.on("participant-left", () => { + // When the bot leaves, we are also disconnecting from the call + disconnect().catch((err) => { + log(`Failed to disconnect ${err}`); + }) + }); callObject.on("error", (evt) => log(`Error: ${evt.error}`)); + // Other events just for awareness + callObject.on("track-started", (evt) => { + handleEventToConsole(evt) + log("Will send the audio message to play the audio at the next tick") + callObject.sendAppMessage("playable") + }); + callObject.on("track-stopped", handleEventToConsole); + callObject.on("participant-joined", handleEventToConsole); + callObject.on("participant-updated", handleEventToConsole); + }; + + const handleEventToConsole = (evt) => { + log(`Received event: ${evt.action}`); }; const connect = async () => { @@ -72,7 +91,6 @@ const CallScreen = () => { Debug Info - Debug logs will appear here... {logs.map((logEntry, index) => ( {logEntry}