Bug Report: WebSocket Audio Not Received & App Cra...
# support
a
Hello, I'm trying to get binary audio data into a React Native app using a WebSocket connection. I followed the example from the official documentation — the connection works, but I'm only receiving text transcriptions, not raw PCM audio as expected. I also tested the React Native SDK, and it works fine in development. However, when I build an APK or upload to TestFlight, the app crashes immediately on launch without any clear error message. Any help would be appreciated. https://cdn.discordapp.com/attachments/1380103711904239676/1380103712210550858/Screenshot_2025-06-05_at_11.03.34.png?ex=6842a93e&is=684157be&hm=8cd8aead02d93422012046a1700489869709a3a8f8e3e57f1440ec8eb8dc6087& https://cdn.discordapp.com/attachments/1380103711904239676/1380103712571265024/image.png?ex=6842a93e&is=684157be&hm=8a9c6654779993e59780ca182b3a193430dcd46ac93c8238e863b61f533b5589&
v
Try this official WebSocket event handler for binary audio:
Copy code
javascript
socket.onmessage = (event) => {
  if (event.data instanceof Blob) {
    event.data.arrayBuffer().then(buffer => {
      const audioData = new Int16Array(buffer);
      // playAudio(audioData);
    });
  } else {
    try {
      const message = JSON.parse(event.data);
      // handleControlMessage(message);
    } catch (error) {
      console.error("Failed to parse message:", error);
    }
  }
};
If you're not receiving binary audio in React Native, double-check that your environment supports
Blob
in WebSocket messages—React Native may require additional setup or a polyfill for this feature. Source: - [Vapi WebSocket Transport Documentation](https://docs.vapi.ai/calls/websocket-transport)
k
Hey Alex, can you please create an github issue and tag me over there.