Advertisement
Guest User

Twisted/Wokkel XMPP Client example

a guest
Feb 22nd, 2011
637
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.65 KB | None | 0 0
  1. from twisted.words.protocols.jabber.jid import JID
  2.  
  3. from wokkel import client
  4.  
  5. jid = JID("user@example.org")
  6. secret = 'mysecret'
  7.  
  8. xmppClient = client.XMPPClient(jid, secret)
  9. xmppClient.logTraffic = True
  10.  
  11. if __name__ == "__main__":
  12.     # Start as a regular Python script.
  13.  
  14.     import sys
  15.     from twisted.python import log
  16.     from twisted.internet import reactor
  17.  
  18.     log.startLogging(sys.stdout, setStdout=0)
  19.     xmppClient.startService()
  20.     reactor.run()
  21. else:
  22.     # Start as a Twisted Application
  23.  
  24.     from twisted.application import service
  25.     application = service.Application("XMPP Client")
  26.     xmppClient.setServiceParent(application)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement