From 729571b5e29315e437c6b74c0e644365728e4187 Mon Sep 17 00:00:00 2001 From: root Date: Thu, 29 Oct 2015 17:01:47 +0100 Subject: [PATCH] tester files for rpc --- utils/rpc_test.py | 19 +++++++++++++++++++ utils/wamp_rpc_server.py | 6 ++++++ 2 files changed, 25 insertions(+) create mode 100644 utils/rpc_test.py create mode 100644 utils/wamp_rpc_server.py diff --git a/utils/rpc_test.py b/utils/rpc_test.py new file mode 100644 index 0000000..1852e67 --- /dev/null +++ b/utils/rpc_test.py @@ -0,0 +1,19 @@ +from autobahn.twisted.wamp import ApplicationSession +from twisted.internet.defer import inlineCallbacks +from autobahn.twisted.wamp import ApplicationRunner + + +class RPCCaller(ApplicationSession): + @inlineCallbacks + def onJoin(self, details): + print("session ready") + try: + res = yield self.call(u'stack4things.conductor.rpc.test',) + print("call result: {}".format(res)) + except Exception as e: + print("call error: {0}".format(e)) + +runner = ApplicationRunner(url=u"ws://localhost:8181/ws", realm=u"s4t") +runner.run(RPCCaller) + + diff --git a/utils/wamp_rpc_server.py b/utils/wamp_rpc_server.py new file mode 100644 index 0000000..f645125 --- /dev/null +++ b/utils/wamp_rpc_server.py @@ -0,0 +1,6 @@ +from iotronic.wamp.rpcwampserver import RPC_Wamp_Server +#NB USE THE IP ADDRESS INSTEAD OF THE HOSTNAME +c=RPC_Wamp_Server('127.0.0.1','8181','s4t') + + +