Add an example for dumping the roster to the command line.
[slixmpp.git] / examples / rpc_async.py
blob0b6d1936f7601e287cde7c4ab20eacc49ae27977
1 """
2 SleekXMPP: The Sleek XMPP Library
3 Copyright (C) 2011 Dann Martens
4 This file is part of SleekXMPP.
6 See the file LICENSE for copying permission.
7 """
9 from sleekxmpp.plugins.xep_0009.remote import Endpoint, remote, Remote, \
10 ANY_ALL, Future
11 import time
13 class Boomerang(Endpoint):
15 def FQN(self):
16 return 'boomerang'
18 @remote
19 def throw(self):
20 print "Duck!"
24 def main():
26 session = Remote.new_session('kangaroo@xmpp.org/rpc', '*****')
28 session.new_handler(ANY_ALL, Boomerang)
30 boomerang = session.new_proxy('kangaroo@xmpp.org/rpc', Boomerang)
32 callback = Future()
34 boomerang.async(callback).throw()
36 time.sleep(10)
38 session.close()
42 if __name__ == '__main__':
43 main()