def on_message(self, message): """ Pass on received message to Process Args: message(str): Received message """ d = json_decode(message) request = deserialize_object(d, Request) request.context = self self.servercomms.on_request(request)
def on_message(self, message): """ Pass response from server to process receive queue Args: message(str): Received message """ try: self.log_debug("Got message %s", message) d = json_decode(message) response = deserialize_object(d, Response) self.send_to_caller(response) except Exception as e: # If we don't catch the exception here, tornado will spew odd # error messages about 'HTTPRequest' object has no attribute 'path' self.log_exception("on_message(%r) failed", message)
def post(self, endpoint_str): endpoint = endpoint_str.split("/") parameters = json_decode(self.get_body_argument("parameters")) request = Post(self, None, endpoint, parameters) self.servercomms.on_request(request)