How shall I restart the websocket as and when I wish through my logic. At some point in my logic and use kws.stop() command to close the websocket thread. At some other point in my logic, I need to call the function which creates websocket again and use the ticks. but when I do that, it throws this error: twisted.internet.error.ReactorNotRestartable
what does it mean and how I solve this issue? Thanks in advance
This error is thrown by the Twisted when you are trying to re-run a reactor that was stopped. You can not use the same process to re-run the reactor, once it's stopped by the reactor.stop() event. This same event is used in the on_close method as well.
Thanks Rakeshr, I get this much now. Facing new challenge now.
Even if I use close() function like kws.close() and later recall the function that creates the websocket and run the thread, it fails to create the websocket. How do I close and restart the websocket as and when required by the logic that I am writing?
oh okay. so the only solution left is to use multiprocessing. create a process for websocket. use it. close it when I want. and restart it. sounds plausible?
what happens to the websocket connection when the token expires due to the change of date? will it restart working if I update the access_token through another function?
I reframe the question: what happens to websocket connection when the access token expires? and when does access token expires? Does the expiry of access token has no effect on websocket?
Even if I use close() function like
kws.close()
and later recall the function that creates the websocket and run the thread, it fails to create the websocket. How do I close and restart the websocket as and when required by the logic that I am writing?