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

Closing stream connection #311

Open
alienbrett opened this issue May 29, 2022 · 1 comment
Open

Closing stream connection #311

alienbrett opened this issue May 29, 2022 · 1 comment

Comments

@alienbrett
Copy link

I'm writing an application that runs a stream client before stopping it later, and I was frustrated with the stream client lifecycle.

If you're having problems with tasks being cancelled on event loop closure with Asyncio, try the following line after unsubscribing (or just after you stop handling stream messages):

if stream_client._socket is not None:
    await stream_client._socket.close()

I spent hours trying to figure out where my async flow was failing, and I realized far too late that it was due to bad socket handling with this library.

@alexgolec
Copy link
Owner

alexgolec commented May 31, 2022

Can you please provide some code that demonstrates this issue? I'd like to fix it but I need to be able to trigger the problem on command to do so.

https://tda-api.readthedocs.io/en/latest/help.html#provide-adequate-information

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

No branches or pull requests

2 participants