I wrote a callback function using twisted Now my question is when websocket connection dropped I need to stop this callback.
def sendBack(self, payload):
# find correct way to identify connection dropped now using wasnotcl...
if self.wasNotCleanReason:
# stop this callback
self.sendMessage("Message")
reactor.callLater(delay, self.sendBack, payload=payload)
You can cancel
it...
callID = reactor.callLater(delay, self.sendBack, payload=payload)
if self.wasNotCleanReason:
callID.cancel()