Search code examples
pythonxmppxmpppy

How can I get a response with XMPP client in Python


I'm using XMPP in Python, and I can send messages, but how can I receive?


Solution

  • I must register a handler and process:

    def messageCB(sess,mess):
        print 'MESSAGE'*100
        nick=mess.getFrom().getResource()
        text=mess.getBody()
        #print mess,nick
        print text
    
    client.RegisterHandler('message',messageCB)
    
    while 1:
        client.Process(1)