Issue with websocket on react native app

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);
                }
            };

In case you face the same issue. For some reason on mobile it doesn’t work so what I did is created a node server that proxies gemini’s websocket and with that the connection worked

i am getting same issue. Has your issue been fixed?

Yes the solution is to create a server that proxies the gemini’s websocket.