问题
I run crossbar client with the runner of crossbar which run in the asyncio event loop. I want to call RPC by the trigger in tkinter. Is there any solution to combine them together?
回答1:
You can make an HTTP request to call your RPC. Everything described here Crossbar HTTP Bridge Caller. Quick summary what you need to do:
- Make configuration:
The HTTP Caller is configured on a path of a Web transport - here is part of a Crossbar configuration:
{ "workers": [ { "type": "router", ... "transports": [ { "type": "web", ... "paths": { ... "call": { "type": "caller", "realm": "realm1", "role": "anonymous" } } } ] } ] }
- In your application make HTTP request
For example, using curl:
curl -H "Content-Type: application/json" \
-d '{"procedure": "com.example.add2", "args": [1, 2]}' \
http://127.0.0.1:8080/call
来源:https://stackoverflow.com/questions/51393304/how-i-can-integrate-crossbar-client-python3-asyncio-with-tkinter