title: Python & Autobahn with Twisted: reset maxRetries within ReconnectingClientFactory
body: <p>I'm trying to work on reconnecting a client if for some reason the connection is 'broken' using Python &amp; Autobahn with Twisted. </p>
  
  <p>There is a nice example <a href="https://github.com/tavendo/AutobahnPython/blob/master/examples/twisted/websocket/echo_variants/client_reconnecting.py" rel="nofollow">here</a> using ReconnectingClientFactory settings but my question is around the maxRetries.</p>
  
  <p>The way it is setup 5 are allowed in total during the script execution.</p>
  
  <pre><code>class EchoClientFactory(ReconnectingClientFactory, WebSocketClientFactory):
      protocol = EchoClientProtocol
      # http://twistedmatrix.com/documents/current/api/twisted.internet.protocol.ReconnectingClientFactory.html
      #
      maxDelay = 10
      maxRetries = 5
      def startedConnecting(self, connector):
          print('Started to connect.')
      def clientConnectionLost(self, connector, reason):
          print('Lost connection. Reason: {}'.format(reason))
          ReconnectingClientFactory.clientConnectionLost(self, connector, reason)
      def clientConnectionFailed(self, connector, reason):
          print('Connection failed. Reason: {}'.format(reason))
          ReconnectingClientFactory.clientConnectionFailed(self, connector, reason)
  </code></pre>
  
  <p>If for example there is a problem and the client connects after 2 retries then there are only 3 left and the number is not 'reset' after a successful connection. </p>
  
  <p>How can this be achieved, meaning reset the maxRetries back to 5 after a successful connection - if possible?</p>
  
  <p>Thanks!</p>
  
  <p>Kostas</p>