wee_slack.py 文件源码

python
阅读 21 收藏 0 点赞 0 评论 0

项目:dotfiles 作者: jethrokuan 项目源码 文件源码
def connect(self):
        if not self.connected and not self.connecting:
            self.connecting = True
            if self.ws_url:
                try:
                    ws = create_connection(self.ws_url, sslopt=sslopt_ca_certs)
                    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)
                    self.set_connected()
                    self.connecting = False
                except Exception as e:
                    dbg("websocket connection error: {}".format(e))
                    self.connecting = False
                    return False
            else:
                # The fast reconnect failed, so start over-ish
                for chan in self.channels:
                    self.channels[chan].got_history = False
                s = SlackRequest(self.token, 'rtm.start', {}, retries=999)
                self.eventrouter.receive(s)
                self.connecting = False
                # del self.eventrouter.teams[self.get_team_hash()]
            self.set_reconnect_url(None)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号