I expect the run_forever() in threadedclient.py to return when the websocket has completely finished. However, it can return before the websocket's closed() method has returned.
The run_forver() method checks whether the terminated() method return true. However, ws4py/websocket.py terminate(), the client_terminated and server_terminated properties that terminate() checks are set to true in the beginning, before calling closed(). This means that if the closed() method takes some time (e.g., to do some cleanup), run_forver() returns before closed() has finished.
The solution would be to move the line
self.client_terminated = self.server_terminated = True
in ws4py/websocket.py to the finally block.
I expect the
run_forever()inthreadedclient.pyto return when the websocket has completely finished. However, it can return before the websocket'sclosed()method has returned.The
run_forver()method checks whether theterminated()method return true. However,ws4py/websocket.pyterminate(), theclient_terminatedandserver_terminatedproperties thatterminate()checks are set to true in the beginning, before callingclosed(). This means that if theclosed()method takes some time (e.g., to do some cleanup),run_forver()returns beforeclosed()has finished.The solution would be to move the line
in ws4py/websocket.py to the
finallyblock.