How to close a streaming connection?

I can’t figure out how to properly close a streaming connection…

I do see this example that shows how to pause the websocket, but that doesn’t actually close the connection, I’m still authenticated.


My problem is I’m using TKinter for UI in Python, but when I click the X icon to close the window and close my program, it doesn’t actually close because it’s still connected to the stream.

I’m sure this is a noob question, but I’ve dug through the API and I can’t figure it out.

Idk if this is an asyncio issue, or a threading issue, a tkinter issue, or a Alpaca API issue. I’m a Python novice.