Python websockets.exceptions() Examples

The following are 1 code examples of websockets.exceptions(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module websockets , or try the search function .
Example #1
Source File:    From chromewhip with MIT License 5 votes vote down vote up
def send_command(self, command, input_event_type=None, await_on_event_type=None):
        finished = False
        retries = 0
        max_retries = 3
        while not finished:
                return await self._send(*command, input_event_cls=input_event_type, trigger_event_cls=await_on_event_type)
            except websockets.exceptions.ConnectionClosed:
                if retries > max_retries:
                    self._log.error(f'Failed to execute send command {command} after {retries} times!')
                    finished = True
                await self.connect()