-
Notifications
You must be signed in to change notification settings - Fork 47
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
RPC for requesting objects, schema & version #424
Conversation
tribal-tec
commented
Jun 11, 2018
- v1/ prefix for endpoints is gone
- set- replaces notification to update objects
- added get- request to retrieve current object state
I'm waiting for @rolandjitsu to test this, plus I should bump the version now after breaking the API... |
@@ -47,7 +47,6 @@ | |||
|
|||
namespace | |||
{ | |||
const std::string ENDPOINT_API_VERSION = "v1/"; | |||
const std::string ENDPOINT_ANIMATION_PARAMS = "animation-parameters"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's group these methods/endpoints according to which can be a request or a notification. Maybe also according to which have set-*
/get-*
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
const std::string METHOD_INSPECT = "inspect"; | ||
const std::string METHOD_QUIT = "quit"; | ||
const std::string METHOD_REMOVE_MODEL = "remove-model"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aren't 'remove-model'
and 'update-model'
jsonrpc notifications?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can use them with notifications if you want. But they can return true/false on success/error.
const std::string ENDPOINT_VOLUME_PARAMS = "volume-parameters"; | ||
|
||
// REST GET, JSONRPC get-* request | ||
const std::string ENDPOINT_STATISTICS = "statistics"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So 'statistics'
and 'version'
can now be fetched using a jsonrpc request with {method: 'get-statistics'}
/{method: 'get-version'}
?
How about when statistics is broadcasted from the server? Is it broadcasted as {method: 'get-statistics'}
or {method: 'statistics'}
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, they can be requested as you described.
The broadcast haven't changed, so it's statistics
still
7e074d1
to
e35dfb7
Compare
if (schemas.count(param.endpoint) == 0) | ||
throw rockets::jsonrpc::response_error("Endpoint not found", | ||
-12347); | ||
return schemas[param.endpoint]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
json.parse missing here
- v1/ prefix for endpoints is gone - set-<object> replaces <object> notification to update objects - added get-<object> request to retrieve current object state