Not able to receive messages from ejabberd server.

64 views
Skip to first unread message

Saurav Gupta

unread,
Mar 24, 2018, 12:55:29 PM3/24/18
to SleekXMPP Discussion
Hello All,

I am getting this while running code mentioned below error. 

WARNING  Legacy XMPP 0.9 protocol detected.
INFO     Waiting for </stream:stream> from server
WARNING  Legacy XMPP 0.9 protocol detected.
INFO     Waiting for </stream:stream> from server
ERROR    Error processing event handler: <bound method echoBot._session_timeout_check of <__main__.echoBot object at 0x7f891376b650>>
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/sleekxmpp/xmlstream/xmlstream.py", line 1184, in event
    handler[0](out_data)
  File "/usr/local/lib/python2.7/dist-packages/sleekxmpp/xmlstream/xmlstream.py", line 662, in _session_timeout_check
    _handle_session_timeout)
  File "/usr/local/lib/python2.7/dist-packages/sleekxmpp/xmlstream/xmlstream.py", line 1219, in schedule
    repeat, qpointer=self.event_queue)
  File "/usr/local/lib/python2.7/dist-packages/sleekxmpp/xmlstream/scheduler.py", line 220, in add
    raise ValueError("Key %s already exists" % name)
ValueError: Key Session timeout check already exists
ERROR    Key Session timeout check already exists
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/sleekxmpp/xmlstream/xmlstream.py", line 1184, in event
    handler[0](out_data)
  File "/usr/local/lib/python2.7/dist-packages/sleekxmpp/xmlstream/xmlstream.py", line 662, in _session_timeout_check
    _handle_session_timeout)
  File "/usr/local/lib/python2.7/dist-packages/sleekxmpp/xmlstream/xmlstream.py", line 1219, in schedule
    repeat, qpointer=self.event_queue)
  File "/usr/local/lib/python2.7/dist-packages/sleekxmpp/xmlstream/scheduler.py", line 220, in add
    raise ValueError("Key %s already exists" % name)
ValueError: Key Session timeout check already exists

-------------------------------------------------------------------------------------------------------------------
import sys
import getpass, logging
from optparse import OptionParser

import sleekxmpp

class echoBot(sleekxmpp.ClientXMPP):
def __init__(self, jid, passwd):
sleekxmpp.ClientXMPP.__init__(self, jid, passwd)
self.add_event_handler("start_session", self.start)
self.add_event_handler("message", self.message)
def start(self, event):
print("Helo helo")
self.send_presence()
self.get_roster()
def message(self, msg):
print("Message")
print msg;

if __name__ == '__main__' :
optn = OptionParser()
optn.add_option('-q', '--quiet', help='set logging to ERROR', action='store_const', dest='loglevel', const=logging.ERROR, default=logging.INFO)
optn.add_option('-d', '--debug', help='set logging to DEBUG',action='store_const', dest='loglevel', const=logging.DEBUG, default=logging.INFO)
optn.add_option('-v', '--verbose', help='set logging to COMM', action='store_const', dest='loglevel', const=5, default=logging.INFO)
optn.add_option('-j', '--jid', dest = 'jid')
optn.add_option('-p', '--password', dest = 'passwd')
optp, args = optn.parse_args()
if optp.jid == None:
optp.jid = raw_input("Enter Username: ")
if optp.passwd == None:
optp.password = getpass.getpass("Enter Password: ")
logging.basicConfig(level=optp.loglevel, format='%(levelname)-8s %(message)s')
xmpp = echoBot(optp.jid, optp.passwd)
xmpp.register_plugin('xep_0030')
xmpp.register_plugin('xep_0004')
xmpp.register_plugin('xep_0060')
xmpp.register_plugin('xep_0199')
if xmpp.connect(('192.168.2.130', 5222)):
xmpp.process(block=True)
print("Done")
else:
print "Unable to connect"


Can anyone please help me in this? 
Can anyone please help me to figure out how can I receive offline messages from ejabberd server (installed on ubuntu server)?
I am very new to XMPP. I could not find anything helpful while searching for few days on google. Can anyone PLEASEee suggest me what should I refer for using XMPP with Python?
Thanks in advance. 

Reply all
Reply to author
Forward
0 new messages