How I can integrate crossbar client (python3,asyncio) with tkinter

有些话、适合烂在心里 提交于 2019-12-11 06:50:02

问题


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:

  1. 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"
                  }
               }
            }
         ]
      }
   ]
}
  1. 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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!