slazarov / python-signalr-client

SignalR client for python based on asyncio.
MIT License
33 stars 22 forks source link

Transport 'start' can be future and non blocking #8

Closed dqian closed 6 years ago

dqian commented 6 years ago

https://github.com/slazarov/python-signalr-client/blob/fe2da6cd469fce73ec237aa988be66e9fdc58573/signalr_aio/transports/_transport.py#L47

Should asyncio.ensure_future be considered for this call? Currently, I've been wrapping the start invocation on the connection module in a coroutine anyway. Any reason why it should not natively be a coroutine?

slazarov commented 6 years ago

You are right, I guess it depends on how you wrap the client with other modules from your code. However, if you are already running a loop, you should hit Line 49 instead of 47, isn't that the case? Maybe there is a bug and/or I missed something.

I am interested to see your modification

dqian commented 6 years ago

Ah ic. I simply need to run my event loop prior to the start method invocation to trigger ln 49. It just so happens in my test code that's not the case but in production, it will be. Thanks!