Git Product home page Git Product logo

Comments (3)

toolmmy avatar toolmmy commented on August 21, 2024

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.

from libjson-rpc-cpp.

nk1973 avatar nk1973 commented on August 21, 2024

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.
Something like

class AbstarctMyStubServer ...
{
public:
AbstarctMyStubServer(...)
{
}

virtual Json::Value GetLog() = 0;
virtual Json::Value GetLog(const std::string &param1 ) = 0;
virtual Json::Value GetLog(const std::string &param1, const std::string &param1) = 0;
...
};

But the problem is that i don't see this is possible with current lib. (may be i'm wrong).

from libjson-rpc-cpp.

cinemast avatar cinemast commented on August 21, 2024

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.

from libjson-rpc-cpp.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.