-
-
Notifications
You must be signed in to change notification settings - Fork 321
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot add optional parameters to the server method #32
Comments
You should be able to register a method that has an object as parameter (e.g. "params" : {"dateFrom": x, "dateTo":y}). In your callback, based in the provided data in the Json::Value& request you can figure out what you need to return. In this case your callback acts more like a facade. |
Yes this should work for the most of the cases (when params object exist). The only problem is if the client will omit params object - according to spec he may do it - and then the client will received exception. I thinked about something like c++ overloading. Server can register multiple methods with the same name but with different parameter list. class AbstarctMyStubServer ... virtual Json::Value GetLog() = 0; But the problem is that i don't see this is possible with current lib. (may be i'm wrong). |
The thing is, that this behavior is not specified in the standard proposal. If you need such things, fork this repo and adapt this as required. |
I see such limitation in the lib (may be i miss something).
request params may be omitted.
GetLog(optional filter1, optional filter2,...).
So in one run the client can use GetLog(time filter)
like this
{"jsonrpc": "2.0", "method": "GetLog", "params": ["2013/12/00:00:00"], "id": 1}
In the other without any filter (according to the spec this seems to be OK)
{"jsonrpc": "2.0", "method": "GetLog", "id": 1}
But i don't see how i implement this with the lib (something like c++ overloading).
The text was updated successfully, but these errors were encountered: