Пример #1
0
    def _sendMessageSynced(self, msg):
        """ Internally used method to send messages via RCERobotProtocol.
            
            @param msg:         Message which should be sent.
        """
        if not self._conn:
            raise ConnectionError("No connection registered.")

        uriBinary, msgURI = recursiveBinarySearch(msg)

        self._conn.sendMessage(json.dumps(msgURI))

        for data in uriBinary:
            self._conn.sendMessage(data[0] + data[1].getvalue(), binary=True)
Пример #2
0
 def sendMessage(self, msg):
     """ Internally used method to send a message to the robot.
         
         Should not be used from outside the Protocol; instead use the
         methods 'sendDataMessage' or 'sendErrorMessage'.
         
         (Overwrites method from autobahn.websocket.WebSocketServerProtocol)
         
         @param msg:     Message which should be sent.
     """
     uriBinary, msgURI = recursiveBinarySearch(msg)
     
     WebSocketServerProtocol.sendMessage(self, json.dumps(msgURI))
     
     for binData in uriBinary:
         WebSocketServerProtocol.sendMessage(self,
             binData[0] + binData[1].getvalue(), binary=True)