title: How can I send message to clients every x seconds when running a tornado server?
body: <p>I have Python code like this:</p>
  
  <pre><code>class WebSocketHandler(tornado.websocket.WebSocketHandler):
      def check_origin(self, origin):
          print "origin: " + origin
          return True
      # the client connected
      def open(self):
          print "New client connected"
          self.write_message("You are connected")
      # the client sent the message
      def on_message(self, message):
          print "message: " + message
          self.write_message(message)
      # client disconnected
      def on_close(self):
          print "Client disconnected"
  
  socket = tornado.web.Application([(r"/wss", WebSocketHandler),])
  if __name__ == "__main__":
      socket.listen(8888)
      tornado.ioloop.IOLoop.instance().start()
  
  while True:
      readmydata()
      #send message to all connected clients
      time.sleep(3)
  </code></pre>
  
  <p>How can I start the websocket server, but continue with the python code that sends the message to all connected clients? The script blocks at <code>tornado.ioloop.IOLoop.instance().start()</code>, so my <code>while True</code> loop never runs.</p>