Hello everyone. I have an issue in my react native app where when I send the setup object to the websocket or when I send audio chunks I receive data: , isTrusted: false. The exact web version of that works fine but on mobile I get nothing.
Can anyone help me with that?
const ws = new WebSocket(`wss://generativelanguage.googleapis.com/ws/google.ai.generativelanguage.v1alpha.GenerativeService.BidiGenerateContent?key={API_KEY}`);
console.log("Connecting to WebSocket", ws);
setWs(ws);
ws.onopen = () => {
console.log("Sending setup to WebSocket", ws);
ws.send(JSON.stringify({
setup: {
model: "models/gemini-2.0-flash-exp",
generationConfig: {
responseModalities: ["AUDIO"]
}
}
}));
console.log("Connected to WebSocket");
};
ws.onmessage = async (event) => {
try {
console.log("Received WebSocket message type:", event.data);
if(event.data instanceof Blob) {
const arrayBuffer = await event.data.arrayBuffer();
const bytes = new Uint8Array(arrayBuffer);
console.log("Received WebSocket message bytes:", bytes);
}
} catch (error) {
console.error("Error parsing message:", error);
}
};