'Receive audio with Websocket Python

I am currently using this script in python to read audio : https://github.com/spatialaudio/python-sounddevice/blob/master/examples/play_long_file.py

I would like to change the audio playback mode : receive the audio by websocket and no longer by reading in an audio file.

I tried to use the websockets library but I don't understand how to do it because I can't touch the definition of the callback function. I tried to use the websocket library but at each ws.create_connection() I got a connection refused error.

I'm new to websocket and I don't know where to start.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source