Skip to content
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

Merged
merged 1 commit into from
Jun 28, 2018

Conversation

tribal-tec
Copy link
Contributor

  • v1/ prefix for endpoints is gone
  • set- replaces notification to update objects
  • added get- request to retrieve current object state

@tribal-tec
Copy link
Contributor Author

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";
Copy link
Contributor

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-*.

Copy link
Contributor Author

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";
Copy link
Contributor

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?

Copy link
Contributor Author

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";
Copy link
Contributor

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'}?

Copy link
Contributor Author

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

@tribal-tec tribal-tec force-pushed the master branch 2 times, most recently from 7e074d1 to e35dfb7 Compare June 21, 2018 15:24
if (schemas.count(param.endpoint) == 0)
throw rockets::jsonrpc::response_error("Endpoint not found",
-12347);
return schemas[param.endpoint];
Copy link
Contributor Author

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants