tester files for rpc

This commit is contained in:
root 2015-10-29 17:01:47 +01:00
parent 3bcc3cdf45
commit 729571b5e2
2 changed files with 25 additions and 0 deletions

19
utils/rpc_test.py Normal file
View File

@ -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)

6
utils/wamp_rpc_server.py Normal file
View File

@ -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')