Search code examples
node.jsgoogle-cloud-platformspeech-to-textgoogle-cloud-speech

Terminate Google Speech-To-Text streamingRecoginze() RPC call from client side(Node.js SDK)


Is there a way to terminate Google STT streamingRecognize() RPC call from client side? I am using NodeJS library and node-audiorecorder to achive streaming from the Mic.

Also, how do you handle the network unavailability when google client disconnected?

Thanks in advance!


Solution

  • To terminate the the RPC call from the client side you can use audioRecorder.stop() from the node-audiorecorder.

    You can get more information on how gRPC works in the gRPC concepts documentation.

    On how to handle network failures and other errors you can take a look at this. Here you can find some examples.