Holding Streams Open with Stream KeepAlive

Shir Goldberg
Published on 06/06/23Updated on 06/08/23

Share this guide
Want to keep a DG stream alive without sending any data? Now, it’s as easy as:
{ type: KeepAlive }
Our system closes connections if no audio data is sent for a couple seconds, which can make for a frustrating development experience. Whether you want to open a websocket a little bit before you need it, or intermittently stop sending data you don’t want transcribed, there are several reasons you might want to hang on to a websocket while not sending any data.
We’ve heard that this timeout doesn’t serve your needs, and that our customers are looking for a way to keep streams open for longer. Now, you can just send a KeepAlive message, and the stream will remain open for another 60 seconds.
Want to learn more? Head to our documentation.