Reputation: 3651
I just started reading Oreilly's XMPP The Definitive Guide and for the hello world, they have this script:
def main():
bot = EchoBot("[email protected]/HelloWorld", "mypass")
bot.run()
class EchoBot(object):
def __init__(self, jid, password):
self.xmpp = sleekxmpp.ClientXMPP(jid, password)
self.xmpp.add_event_handler("session_start", self.handleXMPPConnected)
self.xmpp.add_event_handler("message", self.handleIncomingMessage)
def run(self):
self.xmpp.connect()
self.xmpp.process(threaded=False)
def handleXMPPConnected(self, event):
self.xmpp.sendPresence(pstatus="Send me a message")
def handleIncomingMessage(self, message):
self.xmpp.sendMessage(message["jid"], message["message"])
But it didn't say how to test and run this on my local machine. I'm really new to xmpp and a bit confused. Do I setup a local xmpp server or is there an existing one sitting around where I can test this?
Upvotes: 2
Views: 1951
Reputation: 32992
Yes, you probably need to install your own server if you want to test it locally. Many servers have a one-click install system that should make it easy to install on your platform.
It should also work with an hosted XMPP account if you have one on a platform like Google Chat (which is XMPP), or any other on platforms like jabber.org.
Upvotes: 3