I am using xmpppy python library to connect with XMPP server(ejabberd2) but unable to connect and actually don't have clarity on how to connect, authenticate and send a message to the server.
Please help me to make it working
If possible please provide some code snippet using XMPPPY.
I figure out the solution with the help of a friend
It requires change the in XMPP ejabberd server config. Change the line {hosts, ["localhost"]} with {hosts, ["localhost", "server-domain", "server-ip-address"]} in the ejabberd.cfg file.
Restart the server and create another user under new hosts with the server domain or server ip.
Code snippet:
import xmpp
ipaddress='<server-ip>'
user='<new-user>' #without @<server-ip>
passwd='<password>'
c = xmpp.Client(ipaddress)
c.connect((ipaddress,5222), secure=0)
c.auth(user,passwd,sasl=1)
c.sendInitPresence()
c.isConnected()
c.send(xmpp.protocol.Message('<jid of receiver user with @<domain> >',"hello world"))