tester files for rpc
This commit is contained in:
parent
3bcc3cdf45
commit
729571b5e2
19
utils/rpc_test.py
Normal file
19
utils/rpc_test.py
Normal 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
6
utils/wamp_rpc_server.py
Normal 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')
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user