[Jsonrpc-cpp-devel] Knowing who sent the request.
Brought to you by:
s-vincent
From: Elestedt, F. <fr...@el...> - 2012-10-05 15:49:20
|
Hi, I'm looking to use jsonrcp-cpp over websockets. The websocket parts is solved by websocketpp, but I now face a "problem" with jsonrcp-cpp and was wondering what you would think would be the best solution for me. What I'm doing is a server where a server can login, and is logged in until socket disconnect. Upon connection an event is to be fired on the server, possibly sending multiple notification messages to the client. So my implementation is a two-way rpc - not just client -> server with responses. I have the client-side all worked out - it is after all much simpler since there is only one server. My problem is that the CallbackMethod does not know from where a message came. So I need to pass this information to the CallbackMethid in some manner. I have two possible suggestions, I've considered both and am looking for something which might be possible to incorporate in the mainline release, and not just a for-me hack... 1. Have the client send the username with each request. The entire request is passed to the callback, so a centralized list of all logged in users would allow the CallbackMethod to make a lookup on the connection to send messages. 2. Add templates to jsonrpc-cpp. Make the callback function take three arguments, one of which is a generic class which would be an application specific connection id container. Any suggestions? Thanks // Fredrik |