diff options
-rw-r--r-- | wee_slack.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/wee_slack.py b/wee_slack.py index 7ba1995..341cb5e 100644 --- a/wee_slack.py +++ b/wee_slack.py @@ -1024,7 +1024,7 @@ class SlackTeam(object): if self.ws_url: try: ws = create_connection(self.ws_url, sslopt=sslopt_ca_certs) - w.hook_fd(ws.sock._sock.fileno(), 1, 0, 0, "receive_ws_callback", self.get_team_hash()) + self.hook = w.hook_fd(ws.sock._sock.fileno(), 1, 0, 0, "receive_ws_callback", self.get_team_hash()) ws.sock.setblocking(0) self.ws = ws # self.attach_websocket(ws) @@ -1048,6 +1048,7 @@ class SlackTeam(object): self.connected = True def set_disconnected(self): + w.unhook(self.hook) self.connected = False def set_reconnect_url(self, url): |