Skip to content
This repository has been archived by the owner on Feb 19, 2020. It is now read-only.

'message' event handler not working #483

Open
ianling opened this issue Feb 20, 2018 · 10 comments
Open

'message' event handler not working #483

ianling opened this issue Feb 20, 2018 · 10 comments

Comments

@ianling
Copy link

ianling commented Feb 20, 2018

I'm running a slightly stripped down version of the boiler plate in the repo's README:

import logging
from sleekxmpp import ClientXMPP
from sleekxmpp.exceptions import IqError, IqTimeout

class EchoBot(ClientXMPP):
    def __init__(self, jid, password):
        ClientXMPP.__init__(self, jid, password)
        self.add_event_handler("message", self.message)

    def message(self, msg):
        logging.debug("HEYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY!!!!!")
        logging.info(repr(msg))
        if msg['type'] in ('chat', 'normal'):
            msg.reply("Thanks for sending\n%(body)s" % msg).send()

if __name__ == '__main__':
    logging.basicConfig(level=logging.DEBUG,
                        format='%(levelname)-8s %(message)s')

    xmpp = EchoBot('user', 'password')
    xmpp.connect(address=("server", 1234))
    xmpp.process(block=True)

I can see DEBUG: RECV: messages appearing in the log, so I know the client is definitely receiving messages, but the event handler isn't running:

DEBUG RECV: <message to="recipient" from="sender" type="normal"><body>ddsadsadsadsa</body></message>

This is on Python 3.6.4 on Windows 10 x86-64.

@loctruong96
Copy link

I have the same problem. It turned out that if it missed the message. It message handler will start working again. If no new message is missed from previous logon session then Echo will stop working.

@lalittech
Copy link

I have the same issue on python 3.5 window 10 and centos 6 python 2.7 .
Message appears in DEBUG logs but message callbacks is never going to receive this inside main class.

@Neustradamus
Copy link

@ianling @loctruong96 @lalittech: Have you tested with "master"?

It works?

If not, have you a patch?
Can you create a PR?

@ianling
Copy link
Author

ianling commented Apr 8, 2019

I moved to a different library as I could not find a solution for this one.

@Neustradamus
Copy link

@ianling: It was the master version that you had tested or other?
What do you use now? :/

@ianling
Copy link
Author

ianling commented Apr 8, 2019

It was likely master. I am currently using my fork of xmppgcm: https://github.com/ianling/xmppgcm

@Neustradamus
Copy link

Thanks for informations but I hope that one guy can solve this problem...

@lalittech
Copy link

Can we use sleek xmpp version 1.3.1 for production use.

@Neustradamus
Copy link

@lalittech
Copy link

lalittech commented Apr 12, 2019

@Neustradamus sleekxmpp v1.3.2 and v 1.3.3 is working. But with certificate expiration with max and approximately 3 months .
But again still message event handlar is not working .
Have you tested 1.3.1 version. If so let me know?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants