speechmatics / speechmatics-js-sdk

Javascript and Typescript SDK for Speechmatics
MIT License
39 stars 6 forks source link

sendAudio is not rate limited and can cause issues when sending faster than real-time #27

Open nickgerig opened 9 months ago

nickgerig commented 9 months ago

Describe the bug using sendAudio faster than real-time can cause the socket to eventually be closed as detailed here: https://docs.speechmatics.com/rt-api-ref#implementation-details

This should be handled by the SDK

To Reproduce

  1. choose a long audio file
  2. with Node use createReadStream() to pass audio to the sendAudio method
  3. The socket will be closed before the audio has finished streaming

Expected behavior The JS SDK should buffer sent data to not overload (as per the docs)

Additional context As a temporary workaround users can set a highwatermark for createReadStream to 4096 or something close to real-time which would delay the issue occurring.