@@ -0,0 +1,2665 @@
+from __future__ import print_function%0Aimport os%0Aimport txaio%0A%0Afrom twisted.internet.defer import inlineCallbacks%0Afrom twisted.internet.endpoints import TCP4ClientEndpoint%0Afrom twisted.internet.endpoints import SSL4ClientEndpoint%0Afrom twisted.internet.endpoints import UNIXClientEndpoint%0Afrom twisted.internet.ssl import optionsForClientTLS, trustRootFromCertificates, Certificate, CertificateOptions%0Afrom twisted.internet import reactor%0A%0Afrom autobahn.twisted.component import Component, run%0Afrom autobahn.twisted.util import sleep%0Afrom autobahn.twisted.wamp import Session%0Afrom autobahn.wamp.types import PublishOptions, SubscribeOptions%0Afrom autobahn.wamp.types import RegisterOptions, CallOptions%0A%0A%0Acomponent = Component(%0A    transports=u'ws://localhost:8080/ws',%0A    realm=u'crossbardemo',%0A)%0A%0A# @component.subscribe(%0A#     u%22com.example.%22,%0A#     options=SubscribeOptions(match=u%22prefix%22),%0A# )%0A# def catch_all(*args, **kw):%0A#     print(%22catch_all(%7B%7D, %7B%7D)%22.format(args, kw))%0A%0A@component.subscribe(%0A    u%22com.example.%22,%0A    options=SubscribeOptions(match=u%22prefix%22, details_arg='details'),%0A)%0Adef an_event(details=None):%0A    print(%22topic '%7B%7D'%22.format(details.topic))%0A%0A%0A@component.register(%0A    u%22com.example.progressive%22,%0A    options=RegisterOptions(details_arg='details'),%0A)%0A@inlineCallbacks%0Adef progressive_callee(details=None):%0A    print(%22progressive%22, details)%0A    if details.progress is None:%0A        raise RuntimeError(%0A            %22You can only call be with an on_progress handler%22%0A        )%0A    for x in %5B'here are', 'some progressive', 'results'%5D:%0A        details.progress(x)%0A        yield sleep(.5)%0A    return None%0A%0A%0A@component.on_join%0Adef join(session, details):%0A    print(%22Session %7B%7D joined: %7B%7D%22.format(details.session, details))%0A%0A    def pub(topic):%0A        print(%22publishing '%7B%7D'%22.format(topic))%0A        return session.publish(%0A            topic,%0A            options=PublishOptions(exclude_me=False),%0A        )%0A%0A    def call_progress(topic):%0A        print(%22calling '%7B%7D' progressively%22.format(topic))%0A        def on_progress(some_data):%0A            print(%22received: '%7B%7D'%22.format(some_data))%0A        return session.call(%0A            topic,%0A            options=CallOptions(on_progress=on_progress)%0A        )%0A%0A    reactor.callLater(1, pub, u'com.example.foo')%0A    reactor.callLater(2, pub, u'com.non_matching')%0A    reactor.callLater(3, pub, u'com.example.some.other.uri')%0A    reactor.callLater(4, call_progress, u'com.example.progressive')%0A    reactor.callLater(7, session.leave)%0A%0A@component.on_leave%0Adef leave(session, details):%0A    print(%22Session leaving: %7B%7D: %7B%7D%22.format(details.reason, details.message))%0A%0A%0Aif __name__ == '__main__':%0A    run(component)%0A

add progressive calls to the component example