Skip to content

Instantly share code, notes, and snippets.

@gmyrianthous
Created November 21, 2021 16:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gmyrianthous/4ff26d7e32e860efae06e2a1ac82b927 to your computer and use it in GitHub Desktop.
Save gmyrianthous/4ff26d7e32e860efae06e2a1ac82b927 to your computer and use it in GitHub Desktop.
Real-time Speech-To-Text Tutorial - Part 3
import json
async def receive_data():
"""
Asynchronous function used for receiving data
"""
while True:
try:
received_msg = await ws_connection.recv()
print(json.loads(received_msg)['text'])
except Exception as e:
print(f'Something went wrong. Error code was {e.code}')
break
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment