Crates.io | lampo-jsonrpc |
lib.rs | lampo-jsonrpc |
version | 0.0.1-alpha.1 |
source | src |
created_at | 2023-12-18 11:01:11.878347 |
updated_at | 2023-12-18 11:01:11.878347 |
description | Crate that provides a plugin API to give the possibility to implement a plugin in Rust |
homepage | https://git.hedwing.dev/dev-crew/lampo.rs |
repository | https://git.hedwing.dev/dev-crew/lampo.rs |
max_upload_size | |
id | 1073276 |
size | 23,677 |
Minimal and full feature pure async JSON RPC 2.0 server implementation.
Provide instructions on how to install your project. For example:
let path = "/tmp/tmp.sock";
let server = JSONRPCv2::new(Arc::new(DummyCtx), path).unwrap();
let _ = server.add_rpc("foo", |_: &DummyCtx, request| {
Ok(serde_json::json!(request))
});
let res = server.add_rpc("secon", |_: &DummyCtx, request| {
Ok(serde_json::json!(request))
});
assert!(res.is_ok(), "{:?}", res);
let handler = server.handler();
let worker = server.spawn();
let request = Request::<Value> {
id: Some(0.into()),
jsonrpc: String::from_str("2.0").unwrap(),
method: "foo".to_owned(),
params: serde_json::Value::Array([].to_vec()),
};
// Client-side code
let client_worker = std::thread::spawn(move || {
// [Add your client-side code here, similar to the example provided]
});
TODO
This project is licensed under the GNU General Public License v2.0 only. For more information, see LICENSE.