title: Run second process started by web socket
body: <p>I have a simple python program that I use to connect a few devices to my HomeKit. To get status change of the devices, I need to connect to a websocket. The websocket returns 2 statuses: &quot;Device status changed&quot; and &quot;Infrastructure has changed (e.g. a new device)&quot;. For the HomeKit integration I use hap-python.</p>
  <p>I am looking for a solution to restart HomeKit to read in a new device.</p>
  <p>This is what I am using now:</p>
  <pre><code>def run_websocket():
      obj = {
          &quot;protocol&quot;: &quot;json&quot;,
          &quot;version&quot;: 1
      }
      ws.send(json.dumps(obj))
  
  def run_homekit():
      homekit.start()
  
  logging.info(&quot;Start websocket client...&quot;)
  _thread.start_new_thread(run_websocket, ())
  
  logging.info(&quot;Start homekit...&quot;)
  _thread.start_new_thread(run_homekit, ())
  </code></pre>