Exemplo n.º 1
0
    def send(self, message):
        """
        Send a Message to the Server.

        The Message is automatically assigned an identifier, and this is
        returned.
        """

        message_id = self.nextId()

        frame = Frame.fromMessage(message.setId(message_id).build())

        self.__socket.sendall(str(frame))

        return message_id
Exemplo n.º 2
0
    def send(self, message):
        """
        Send a Message to the Server.

        The Message is automatically assigned an identifier, and this is
        returned.
        """

        message_id = self.nextId()

        frame = Frame.fromMessage(message.setId(message_id).build())

        self.__socket.sendall(str(frame))

        return message_id
Exemplo n.º 3
0
    def send(self, message):
        """
        Send a Message to the Server.

        The Message is automatically assigned an identifier, and this is
        returned.
        """

        try:
            message_id = self.nextId()
    
            frame = Frame.fromMessage(message.setId(message_id).build())
    
            self.__socket.sendall(str(frame))
    
            return message_id
        except socket.timeout as e:
            raise ConnectionError(e)
        except ssl.SSLError as e:
            raise ConnectionError(e)
Exemplo n.º 4
0
    def write(self, message):
        """
        Writes a message to a client, encapsulating it in a Frame first.
        """

        self.__write(Frame.fromMessage(message))
Exemplo n.º 5
0
    def write(self, message):
        """
        Writes a message to a client, encapsulating it in a Frame first.
        """

        self.__write(Frame.fromMessage(message))