code: def send_message_from_thread(self, stream, msg):
          
          return self.call_from_thread(partial(self.send_message, stream, msg))
docs: Thread-safe version of send_message() returning a Future instance.
  
          Returns
          -------
          A Future that will resolve without raising an exception as soon as
          the call to send_message() completes. This does not guarantee that the
          message has been delivered yet. If the call to send_message() failed,
          the exception will be logged, and the future will resolve with the
          exception raised. Since a failed call to send_message() will result
          in the connection being closed, no real error handling apart from
          logging will be possible.
  
          Notes
          -----
          This method is thread-safe. If called from within the ioloop,
          send_message is called directly and a resolved tornado.concurrent.Future
          is returned, otherwise a callback is submitted to the ioloop that will
          resolve a thread-safe concurrent.futures.Future instance.