How to use the autobahn.twisted.wamp.ApplicationRunner function in autobahn

To help you get started, we’ve selected a few autobahn examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github gammazero / nexus / examples / interop / autobahn-python / sub_callee.py View on Github external
print("Charlie")
                details.progress("Charlie")
                yield sleep(1)

            returnValue("ok")

        try:
            yield self.register(longop, procedure2,
                                RegisterOptions(details_arg='details'))
            print(procedure2, "registered")
        except Exception as e:
            print("could not register procedure: {0}".format(e))


if __name__ == '__main__':
    runner = ApplicationRunner(url=u"ws://localhost:8080/ws", realm=realm)
    runner.run(MyComponent)
    print("Received", event_count, "events")
github MD-Studio / MDStudio / components / lie_cli / lie_cli / cli_services.py View on Github external
def main():
    """
    Main function for enabling mdstudio_cli command line script functionality
    """

    # Parse command line arguments
    cliparser = lie_cli_parser()

    # Connect to MDStudio and call method
    runner = ApplicationRunner(u'ws://localhost:8080/ws', u'liestudio', extra=cliparser)
    runner.run(CliWampApi, auto_reconnect=False, log_level='error')
github crossbario / autobahn-python / examples / twisted / wamp / rpc / cancel / frontend.py View on Github external
arglengths = yield self.call(u'com.arguments.arglen', 1, 2, 3, a = 1, b = 2, c = 3)
      print("Arglen 4: {}".format(arglengths))

      self.leave()


   def onDisconnect(self):
      print("disconnected")
      reactor.stop()



if __name__ == '__main__':
   from autobahn.twisted.wamp import ApplicationRunner
   runner = ApplicationRunner("ws://127.0.0.1:8080/ws", "realm1")
   runner.run(Component)
github crossbario / autobahn-python / examples / twisted / wamp / rpc / progress / frontend.py View on Github external
print("Final: {}".format(res))

        self.leave()

    def onDisconnect(self):
        print("disconnected")
        reactor.stop()


if __name__ == '__main__':
    import six
    url = environ.get("AUTOBAHN_DEMO_ROUTER", u"ws://127.0.0.1:8080/ws")
    if six.PY2 and type(url) == six.binary_type:
        url = url.decode('utf8')
    realm = u"crossbardemo"
    runner = ApplicationRunner(url, realm)
    runner.run(Component)
github eventifyio / eventify / eventify / consumer.py View on Github external
def start(self):
        """
        Start the event loop
        """
        logger.debug('starting event loop')
        runner = ApplicationRunner(
            url=self.config['transport_host'],
            realm=u'realm1',
            extra={'config': self.config, 'callback': self.callback}
        )
        runner.run(ConsumerApp)
github crossbario / autobahn-python / examples / twisted / wamp / wamplet / wampirc / wampirc / service.py View on Github external
return IRCComponent(config)
    else:
        # if no config given, return a description of this WAMPlet ..
        return {'label': 'An IRC bot service component',
                'description': 'This component provides IRC bot services via WAMP.'}


if __name__ == '__main__':
    from autobahn.twisted.wamp import ApplicationRunner

    extra = {
        "server": "tcp:irc.freenode.net:6667"
    }

    # test drive the component during development ..
    runner = ApplicationRunner(
        url="ws://127.0.0.1:8080/ws",
        realm="realm1",
        extra=extra,
        debug=False,  # low-level WebSocket debugging
        debug_wamp=False,  # WAMP protocol-level debugging
        debug_app=True)  # app-level debugging

    runner.run(make)
github crossbario / crossbar / docs / code / client_appsession_rpc_caller.py View on Github external
def onDisconnect(self):
        print("disconnected")
        reactor.stop()


if __name__ == '__main__':
    import six
    url = os.environ.get('CBURL', u'ws://localhost:8080/ws')
    realm = os.environ.get('CBREALM', u'realm1')

    # any extra info we want to forward to our ClientSession (in self.config.extra)
    extra = {
        u'foobar': u'A custom value'
    }
 
    runner = ApplicationRunner(url=url, realm=realm, extra=extra)
    runner.run(ClientSession, auto_reconnect=True)
github Scille / autobahn-sync / autobahn_sync / core.py View on Github external
def resolve(result):
                    logger.debug('[CrochetReactor] callback resolve: %s' % result)
                    ready_deferred.callback(result)
                    return result

                self._async_session.on_join_defer.addCallback(resolve)

                def resolve_error(failure):
                    logger.debug('[CrochetReactor] errback resolve_error: %s' % failure)
                    ready_deferred.errback(failure)

                self._async_session.on_join_defer.addErrback(resolve_error)
                return self._async_session

            self._async_runner = ApplicationRunner(**kwargs)
            d = self._async_runner.run(register_session, start_reactor=False)

            def connect_error(failure):
                ready_deferred.errback(failure)

            d.addErrback(connect_error)
            logger.debug('[CrochetReactor] end bootstrap')
            return ready_deferred
github crossbario / autobahn-python / examples / twisted / wamp / rpc / arguments / backend.py View on Github external
yield self.register(ping, u'com.arguments.ping')
        yield self.register(add2, u'com.arguments.add2')
        yield self.register(stars, u'com.arguments.stars')
        yield self.register(orders, u'com.arguments.orders')
        yield self.register(arglen, u'com.arguments.arglen')
        print("Procedures registered; ready for frontend.")


if __name__ == '__main__':
    import six
    url = environ.get("AUTOBAHN_DEMO_ROUTER", u"ws://127.0.0.1:8080/ws")
    if six.PY2 and type(url) == six.binary_type:
        url = url.decode('utf8')
    realm = u"crossbardemo"
    runner = ApplicationRunner(url, realm)
    runner.run(Component)
github crossbario / autobahn-python / examples / twisted / wamp / rpc / slowsquare / backend.py View on Github external
def slowsquare(x, delay=1):
            yield sleep(delay)
            returnValue(x * x)

        yield self.register(slowsquare, u'com.math.slowsquare')

        print("procedures registered")


if __name__ == '__main__':
    import six
    url = environ.get("AUTOBAHN_DEMO_ROUTER", u"ws://127.0.0.1:8080/ws")
    if six.PY2 and type(url) == six.binary_type:
        url = url.decode('utf8')
    realm = u"crossbardemo"
    runner = ApplicationRunner(url, realm)
    runner.run(Component)