How to use the slackclient._server.Server function in slackclient

To help you get started, we’ve selected a few slackclient examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github jhgg / jeev / jeev / adapter / slack.py View on Github external
def _do_slack_connection(self):
        if self._server:
            self._server.websocket.abort()

        self._server = Server(self._opts['slack_token'], False)
        self._server.rtm_connect()
        self._parse_login_data(self._server.login_data)
        self._server.websocket.sock.setblocking(1)
        self.api.im.close(channel='D038BM8HQ')

        while True:
            try:
                frame = self._server.websocket.recv()
                self._handle_frame(frame)
            except WebSocketConnectionClosedException:
                logger.error('WebSocket connection closed.')
                self._server.rtm_connect(reconnect=True)
                logger.info('Restarted WebSocket connection')