Hello,
I am definitly learning as fast as I can, Python and tornado server. In your example project, browser streaming robot (which I can run perfectly and have actually modified some of the code myself) how can I configure “robot_web_server.py” so it can write_message back to the connected user.
I grabbed this from the tornado docs but obviously we dont have a reference to “self.ws_connection”. how can i configure your script so I can return a message? I would like to us eit for the ultrasonic sensor and return distance (I have the python code all written to GET the value, just need to return it via the web socket connection)
Thanks for any guidance!!
def write_message(self, message, binary=False):
"""Sends the given message to the client of this Web Socket.
"""
if self.ws_connection is None:
raise WebSocketClosedError()
if isinstance(message, dict):
message = tornado.escape.json_encode(message)
return self.ws_connection.write_message(message, binary=binary)