Esempio n. 1
0
    def disconnect(self):
        self.connection.close()

    def receive_message(self, message):
        chat.DisplayMsgToUser(message)

    def send_payload(self, data):
        # TODO: Handle sending of a payload
        sendMsg = json.dumps(data)
        rawSendMsg = sendMsg.encode()
        self.connection.send(rawSendMsg)

    def set_Chat(self, chat):
        self.Chat = chat


if __name__ == '__main__':
    """
    This is the main method and is executed when you type "python Client.py"
    in your terminal.

    No alterations are necessary
    """

    client = Client('localhost', 9998)
    chat = Chat(client)
    client.set_Chat(chat)
    chat.start()
    while True:
        pass