Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor Live Client for v3 #186

Merged
merged 1 commit into from
Nov 22, 2023

Conversation

davidvonthenen
Copy link
Contributor

@davidvonthenen davidvonthenen commented Nov 22, 2023

This PR introduces the following:

  • Refactor the Live client to use IO threading versus async/wait. Found a pretty significant issue which could affect throughput of streaming to the websocket. async/wait is good for non-real-time things as it simplifies things since async/wait uses a single thread for all functions, objects, etc. This turns out to be not so great for IO intensive tasks since pushing the IO will be interrupted from every other thread doing async/wait stuff because they all share a single thread. More info here and here.
  • Preserves the async/await Live client implementation to be marked for deprecation in the next major/minor version. A warning will be printed to the user informing them this will be deleted in a future release.
  • Introduces a helper class to implement microphone input using pyaudio (backed by portaudio).
  • Introduces a simple example "main" style application (located at examples/streaming/microphone) of using the microphone with the Live client.
  • Refactors the errors not be global and places them into their own modules.
  • KeepAlive messages are disabled by default but can be optionally enabled.

This PR should address the following issues:

Verified all the examples including the examples/streaming/http using the Legacy client still works correctly.

@davidvonthenen davidvonthenen force-pushed the refactor-live-client branch 5 times, most recently from bbfc14c to 4113b70 Compare November 22, 2023 19:15
@davidvonthenen davidvonthenen merged commit 965100d into deepgram:main Nov 22, 2023
1 check passed
@davidvonthenen davidvonthenen deleted the refactor-live-client branch November 22, 2023 21:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants