Beispiel #1
0
    def _process_service_message(self, ws, string_message):
        json_message = json.loads(string_message)
        print('-r--', json_message["what"])
        if "what" in json_message:
            what = json_message["what"]
            # print('--', what)
            logging.debug(
                'uv4l_server(_process_service_message), what: {}'.format(what))
            if what == 'offer' and self._current_caller != None:
                message = Message(body=json_message,
                                  endpoint='uv4lClient',
                                  method='send',
                                  query={"_systemRequest": True})
                self._current_caller.send_message(message)
                return
            if what == 'iceCandidate' and self._current_caller != None:
                message = Message(body=json_message,
                                  endpoint='uv4lClient',
                                  method='send',
                                  query={"_systemRequest": True})
                self._current_caller.send_message(message)
                return
            if what == 'message' and self._current_caller != None:

                print(json_message)
                return
            else:
                logging.warning(
                    'uv4l_server(_process_service_message), what "{}" not recognized'
                    .format(what))
        else:
            logging.warning(
                'uv4l_server(_process_service_message), Could not process message'
            )
Beispiel #2
0
 def post(self, endpoint, body, query={}):
     out = self.send_message(Message(
         body=body,
         endpoint=endpoint,
         method='post',
         query=query))
     return out
 def post(self, endpoint, body, query={}):
     out = self.remote.send_message(Message(body=body,
                                            endpoint=endpoint,
                                            method='post',
                                            query=query),
                                    connection=self)
     return out
Beispiel #4
0
 def respond(self, _id, error, body):
     response = Message(_id=_id,
                        method='response',
                        body=body,
                        error=error)
     self.send_message(response)
Beispiel #5
0
 def get(self, endpoint, query={}):
     out = self.send_message(Message(
         endpoint=endpoint,
         method='get',
         query=query))
     return out
 def respond(self, _id, error, body):
     self.remote.send_message(Message(body=body,
                                      error=error,
                                      method='respond'),
                              connection=self)
 def get(self, endpoint, query={}):
     out = self.remote.send_message(Message(endpoint=endpoint,
                                            method='get',
                                            query=query),
                                    connection=self)
     return out
 def send(self, endpoint, body, query={}):
     self.remote.send_message(Message(body=body,
                                      endpoint=endpoint,
                                      method='send',
                                      query=query),
                              connection=self)
 def _convert_message(string_message):
     json_message = json.loads(string_message)
     message = Message(**json_message)
     message.connection = self
     message.remote = self.remote
     return message
Beispiel #10
0
 def send(self, endpoint, body, query={}):
     message = Message(body=body,
                       endpoint=endpoint,
                       method='send',
                       query=query)
     self.send_message(message)