I found several potential reasons why child threads were not exiting.
thread_stop_event is read but never written
queue.Queue.get called in blocking mode without a timeout, preventing write thread from exiting
Web socket requests can restart threads. Not sure if this is strictly related, but it seems simpler to account for the threads if they are started once.
asyncio.queue.get is called with no timeout in the websocket handler, preventing it from exiting (it seems)
Proposed fix for #29
I found several potential reasons why child threads were not exiting.
See also these notes on aiohttp graceful shutdown: https://docs.aiohttp.org/en/v0.22.4/web.html#aiohttp-web-graceful-shutdown
Address the above with the following changes
Also