Exemple #1
0
        def send(msg):
            binaries, jsonMsg = recursiveBinarySearch(msg)

            WebSocketClientProtocol.sendMessage(self, json.dumps(jsonMsg))

            for data in binaries:
                msg = data[0] + data[1].getvalue()
                WebSocketClientProtocol.sendMessage(self, msg, binary=True)
Exemple #2
0
    def sendMessage(self, msg):
        """ Internally used method to send messages via WebSocket connection.
            Thread-safe implementation.

            @param msg:         Message which should be sent.
        """
        binaries, msg = recursiveBinarySearch(msg)
        msg = json.dumps(msg)

        if isInIOThread():
            self._send(msg, binaries)
        else:
            self._connection.reactor.callFromThread(self._send, msg, binaries)
Exemple #3
0
    def sendMessage(self, msg):
        """ Internally used method to send messages via WebSocket connection.
            Thread-safe implementation.

            @param msg:         Message which should be sent.
        """
        binaries, msg = recursiveBinarySearch(msg)
        msg = json.dumps(msg)

        if isInIOThread():
            self._send(msg, binaries)
        else:
            self._connection.reactor.callFromThread(self._send, msg, binaries)
Exemple #4
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)
Exemple #5
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)