def run(on_create):
    from twisted.internet import reactor

    # multiple, configurable transports, either via dict-like config, or
    # from native Twisted endpoints
    transports = [
        {
            "type": "websocket",
            "url": "ws://127.0.0.1:8080/ws"
        }
    ]

    # a connection connects and automatically reconnects WAMP client
    # transports to a WAMP router. A connection has a listener system
    # where user code can hook into different events : on_join
    connection = Connection(on_create, realm=u'public',
        transports=transports, reactor=reactor)

    # the following returns a deferred that fires when the connection is
    # finally done: either by explicit close by user code, or by error or
    # when stop reconnecting
    done = connection.connect()

    def finish(res):
        print(res)
        reactor.stop()

    done.addBoth(finish)

    reactor.run()
This could be a high level "runner" tool we ship.
dataset/ETHPy150Open crossbario/autobahn-python/examples/twisted/wamp/work/newapi/test_newapi.py/run