mandrewcito / signalrcore

SignalR Core python client
https://mandrewcito.github.io/signalrcore/
MIT License
115 stars 53 forks source link

Updated websocket library and fixed bugs due to reconnects #98

Open dcmeglio opened 1 year ago

dcmeglio commented 1 year ago

This fixes #97 . I removed unnecessary threads that were being created around run_forever. run_forever already creates a thread so this is a waste of resources. I also discovered the constant reconnect issue was because the connection checker was continuing to run while in reconnect mode. This was because of a bad state check. We now kill the connection checker no matter what when stop() is called. I also updated the websocket-client library because it was very out of date. This resolved all my issues and seemed to introduce no additional problems in my testing.

This library seems like it might be dead but I hope you'll consider this PR. I'd hate to have to maintain a fork just to fix this bug :(

fijackokresimir commented 1 year ago

i tried running your version and it seems that reconnection is functioning better, but i still have ocasionally errors such as websocketbadstatusexception 404 during handshake. i am running asp.net core 6 app and i tried to turn it off / on and it sometimes work but sometimes i get this 404 on handshake which is weird. i tried skipNegotiation=true, but it didn't help

have you experienced these errors? am i missing something? i thought that this reconnect should work out of the box. i noticed that 'websocket_transport.py' ln167 has '#raise HubError(error)' which maybe should be uncommented to at least have on_error event triggered ?

thch-cubido commented 5 months ago

start will then cause the calling thread to block. This is why it has been wrapped, I guess.