def sendMessage(self, msg): """ This method is called by the User instance to send a message to the robot. @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)
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)