I am trying to use Autobahn|Python as a websocket client for the following use case:
- I have a remote server which uses WebSockets to carryout JSON RPC commands.
- A WebSocket client can send a JSON RPC command (with a command id) and the server asynchronously responds to that command with the same id.
- The server can also publish events asynchronously on the same WebSocket channel which are to be interpreted by the client code as appropriate.
The problem I am facing is that I want the protocol handling to be detached from the main thread of my Python application. Event loop achieves that but I also need synchronization events between my main thread and the WebSocket event loop. For example, here’s a use case that I am not able to find examples for in the community: Send a JSON RPC command to the server and waits synchronously for a response to arrive.
How do I achieve this in autobahn|python? Are there any examples that are a bit more fancier than a simple echo example?