Skip to content
forked from cuiopen/json-rpc

JSON-RPC 2.0 provider for .NET 5

License

Notifications You must be signed in to change notification settings

mimirobo/json-rpc

 
 

Repository files navigation

Anemonis.JsonRpc

Provides support for serializing and deserializing JSON-RPC 2.0 messages.

Release Current
Artifacts
Code Health
Build Status

Project Details

  • Supports dynamic response type contracts based on method parameters.
  • Provides limited backward compatibility with the JSON-RPC 1.0 protocol.

Code Examples

var contracts = new JsonRpcContractResolver();
var serializer = new JsonRpcSerializer(contracts);

contracts.AddResponseContract("sum", new JsonRpcResponseContract(typeof(long)));

var request = new JsonRpcRequest(1L, "sum", new[] { 1L, 2L });
var requestString = serializer.SerializeRequest(request);

// ...

contracts.AddResponseBinding(request.Id, request.Method);

var responseData = serializer.DeserializeResponseData(responseString);
var response = responseData.Item.Message;

Console.WriteLine((long)response.Result);

Quicklinks

About

JSON-RPC 2.0 provider for .NET 5

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C# 100.0%