class_docstr: Start, connect and watch over the TWS or gateway app and try to keep it
  up and running. It is intended to be used in an event-driven
  application that properly initializes itself upon (re-)connect.
  
  It is not intended to be used in a notebook or in imperative-style code.
  Do not expect Watchdog to magically shield you from reality. Do not use
  Watchdog unless you understand what it does and doesn't do.
  
  Args:
      controller (IBC): (required) IBC instance.
      ib (IB): (required) IB instance to be used. Do not connect this
          instance as Watchdog takes care of that.
      host (str): Used for connecting IB instance.
      port (int):  Used for connecting IB instance.
      clientId (int):  Used for connecting IB instance.
      connectTimeout (float):  Used for connecting IB instance.
      readonly (bool): Used for connecting IB instance.
      appStartupTime (float): Time (in seconds) that the app is given
          to start up. Make sure that it is given ample time.
      appTimeout (float): Timeout (in seconds) for network traffic idle time.
      retryDelay (float): Time (in seconds) to restart app after a
          previous failure.
      probeContract (Contract): Contract to use for historical data
          probe requests (default is EURUSD).
      probeTimeout (float); Timeout (in seconds) for the probe request.
  
  The idea is to wait until there is no traffic coming from the app for
  a certain amount of time (the ``appTimeout`` parameter). This triggers
  a historical request to be placed just to see if the app is still alive
  and well. If yes, then continue, if no then restart the whole app
  and reconnect. Restarting will also occur directly on errors 1100 and 100.
  
  Example usage:
  
  .. code-block:: python
  
      def onConnected():
          print(ib.accountValues())
  
      ibc = IBC(974, gateway=True, tradingMode='paper')
      ib = IB()
      ib.connectedEvent += onConnected
      watchdog = Watchdog(ibc, ib, port=4002)
      watchdog.start()
      ib.run()
  
  Events:
      * ``startingEvent`` (watchdog: :class:`.Watchdog`)
      * ``startedEvent`` (watchdog: :class:`.Watchdog`)
      * ``stoppingEvent`` (watchdog: :class:`.Watchdog`)
      * ``stoppedEvent`` (watchdog: :class:`.Watchdog`)
      * ``softTimeoutEvent`` (watchdog: :class:`.Watchdog`)
      * ``hardTimeoutEvent`` (watchdog: :class:`.Watchdog`)
class_docstr_tok: ["Start",",","connect","and","watch","over","the","TWS","or","gateway","app","and","try","to","keep","it","up","and","running",".","It","is","intended","to","be","used","in","an","event-driven","application","that","properly","initializes","itself","upon","(","re-",")","connect",".","It","is","not","intended","to","be","used","in","a","notebook","or","in","imperative-style","code",".","Do","not","expect","Watchdog","to","magically","shield","you","from","reality",".","Do","not","use","Watchdog","unless","you","understand","what","it","does","and","does","n't","do",".","Args",":","controller","(","IBC",")",":","(","required",")","IBC","instance",".","ib","(","IB",")",":","(","required",")","IB","instance","to","be","used",".","Do","not","connect","this","instance","as","Watchdog","takes","care","of","that",".","host","(","str",")",":","Used","for","connecting","IB","instance",".","port","(","int",")",":","Used","for","connecting","IB","instance",".","clientId","(","int",")",":","Used","for","connecting","IB","instance",".","connectTimeout","(","float",")",":","Used","for","connecting","IB","instance",".","readonly","(","bool",")",":","Used","for","connecting","IB","instance",".","appStartupTime","(","float",")",":","Time","(","in","seconds",")","that","the","app","is","given","to","start","up",".","Make","sure","that","it","is","given","ample","time",".","appTimeout","(","float",")",":","Timeout","(","in","seconds",")","for","network","traffic","idle","time",".","retryDelay","(","float",")",":","Time","(","in","seconds",")","to","restart","app","after","a","previous","failure",".","probeContract","(","Contract",")",":","Contract","to","use","for","historical","data","probe","requests","(","default","is","EURUSD",")",".","probeTimeout","(","float",")",";","Timeout","(","in","seconds",")","for","the","probe","request",".","The","idea","is","to","wait","until","there","is","no","traffic","coming","from","the","app","for","a","certain","amount","of","time","(","the","``","appTimeout","``","parameter",")",".","This","triggers","a","historical","request","to","be","placed","just","to","see","if","the","app","is","still","alive","and","well",".","If","yes",",","then","continue",",","if","no","then","restart","the","whole","app","and","reconnect",".","Restarting","will","also","occur","directly","on","errors","1100","and","100",".","Example","usage",":","..","code-block",":",":","python","def","onConnected","(",")",":","print","(","ib.accountValues","(",")",")","ibc","=","IBC","(","974",",","gateway=True",",","tradingMode='paper","'",")","ib","=","IB","(",")","ib.connectedEvent","+=","onConnected","watchdog","=","Watchdog","(","ibc",",","ib",",","port=4002",")","watchdog.start","(",")","ib.run","(",")","Events",":","*","``","startingEvent","``","(","watchdog",":",":","class",":","`",".Watchdog","`",")","*","``","startedEvent","``","(","watchdog",":",":","class",":","`",".Watchdog","`",")","*","``","stoppingEvent","``","(","watchdog",":",":","class",":","`",".Watchdog","`",")","*","``","stoppedEvent","``","(","watchdog",":",":","class",":","`",".Watchdog","`",")","*","``","softTimeoutEvent","``","(","watchdog",":",":","class",":","`",".Watchdog","`",")","*","``","hardTimeoutEvent","``","(","watchdog",":",":","class",":","`",".Watchdog","`",")"]
code: def start(self):
      self._logger.info("Starting")
      self.startingEvent.emit(self)
      self._runner = asyncio.ensure_future(self.runAsync())
      return self._runner
  
file_path: ib_insync/ib_insync/ibcontroller.py
imports: import asyncio
  import logging
  import sys
  from contextlib import suppress
  from dataclasses import dataclass
  from typing import ClassVar
  from eventkit import Event
  import ib_insync.util
  from ib_insync.contract import Contract, Forex
  from ib_insync.ib import IB
label_desc: Use image node_id 2 for calling the Watchdog obj's underlying member method code with example usage: obj.start() and returns: self