uskr / jsonrpc-lean Goto Github PK
View Code? Open in Web Editor NEWLightweight, fast, transport-agnostic, c++ implementation of the JSON-RPC 2.0 specification
License: GNU Lesser General Public License v3.0
Lightweight, fast, transport-agnostic, c++ implementation of the JSON-RPC 2.0 specification
License: GNU Lesser General Public License v3.0
Nice library 🍰
When compiling with GCC C++14 flavour on Linux I had to make a small change in util.h
in line 24
#include <string.h>
Apparently memset
is part of <string.h>
and not STL's <string>
.
See also on Stackoverflow this answer:
You should use #include <string.h> in both C and C++, if you want to use ::memset. #include gets you std::memset, and if it also makes ::memset available, it does so by accident. The Standard permits it but does not require it to do so
Right now I have not time to compile on Mac and Windows, therefore I did not assemble a pull request though.
When giving a number as text (e.g. "33"
) for a request parameter the JSON parser interprets it as a date type.
E.g. (see examples/testserver.cpp)
std::string Concat(const std::string& a, const std::string& b) {
return a + b;
}
dispatcher.AddMethod("concat", &Concat);
const char request[] = R"({"jsonrpc":"2.0","method":"concat","id":1,"params":["Hello, ","33"]})";
server.HandleRequest(concatRequest);
// -> {"jsonrpc":"2.0","id":1,"error":{"code":-32602,"message":"Invalid parameters"}}
jsonrpc::util::ParseIso8601DateTime
as called from JSON reader in Value GetValue(const rapidjson::Value&)
returns true
which is wrong. Live demo here.
I did not expect treatment for data strings since IMO it is not part of the JSON standard. I guess interpreting strings as data and serializing dates into strings, would better done in the application layer, or I'd rather pick a whole other data format like MessagePack.
I would not be sad if support for Value::Type::DATE_TIME
is simply kicked out of jsonrpc-lean. 😑
Hi! Thank you for the library!
Can you please make a release of the library? It helps a lot with packaging your libray into dependency managers like Conan.
For packaging we require version of a library. Without your help we cannot do it, unfortunately.
Thank you a lot!
Hello,
nice approach, but not really useful.
Since you advertise you library as header only, then I would suggest to change license LGPL v2.1 to LGPL v3.0. Because LGPL v2.1 requires to link library dynamically, which is problematic with headers only libraries and is solved in LGPL v3.0, as stated here:
http://eigen.tuxfamily.org/index.php?title=Licensing_FAQ&oldid=1117#But_doesn.27t_the_LGPL_have_issues_with_code_that_is_in_header_files.2C_and_template_libraries.3F
Is there a reason why uint32_t and uint64_t are omitted from Value type? I see they are being converted to int64_t and double receptively. The problem is I'm unable to 'AddMethod' following :
uint32_t foo() {}
Thank you,
J
Hi
Im trying to use your jsonrpc implementation, thanks for making that!!
But i may be missing something, because i don't see anywhere how to set the server ip and port.......
How can i know which ip and port are the server running??¿¿¿
Thanks!!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.