All Projects β†’ borderless β†’ Json Rpc

borderless / Json Rpc

Licence: mit
Tiny, type-safe JSON-RPC 2.0 implementation

Programming Languages

typescript
32286 projects

Labels

Projects that are alternatives of or similar to Json Rpc

node-jsonrpc2
JSON-RPC 2.0 server and client library, with HTTP (with Websocket support) and TCP endpoints
Stars: ✭ 103 (+472.22%)
Mutual labels:  json-rpc
Hyperf
πŸš€ A coroutine framework that focuses on hyperspeed and flexibility. Building microservice or middleware with ease.
Stars: ✭ 4,206 (+23266.67%)
Mutual labels:  json-rpc
Oui
A modern web interface for OpenWrt implemented in vue.js and Lua.
Stars: ✭ 594 (+3200%)
Mutual labels:  json-rpc
web3j-scala
Lightweight and idiomatic Scala wrapper around Web3J for Ethereum.
Stars: ✭ 75 (+316.67%)
Mutual labels:  json-rpc
Joyrpc
high-performance, high-extensibility Java rpc framework.
Stars: ✭ 290 (+1511.11%)
Mutual labels:  json-rpc
Vs Streamjsonrpc
The StreamJsonRpc library offers JSON-RPC 2.0 over any .NET Stream, WebSocket, or Pipe. With bonus support for request cancellation, client proxy generation, and more.
Stars: ✭ 421 (+2238.89%)
Mutual labels:  json-rpc
laravel-bitcoinrpc
Bitcoin JSON-RPC Service Provider for Laravel.
Stars: ✭ 83 (+361.11%)
Mutual labels:  json-rpc
Delphimvcframework
DMVCFramework (for short) is a popular and powerful framework for web solution in Delphi. Supports RESTful and JSON-RPC APIs development.
Stars: ✭ 761 (+4127.78%)
Mutual labels:  json-rpc
Json Rpc
πŸ” JSON-RPC 1/2 transport implementation. Supports python 2/3 and pypy.
Stars: ✭ 359 (+1894.44%)
Mutual labels:  json-rpc
Getty
a netty like asynchronous network I/O library based on tcp/udp/websocket; a bidirectional RPC framework based on JSON/Protobuf; a microservice framework based on zookeeper/etcd
Stars: ✭ 532 (+2855.56%)
Mutual labels:  json-rpc
rpcsrv
JSON-RPC server based on C++11 and libevent
Stars: ✭ 28 (+55.56%)
Mutual labels:  json-rpc
Ion Sfu
Pure Go WebRTC SFU
Stars: ✭ 258 (+1333.33%)
Mutual labels:  json-rpc
Web3swift
Elegant Web3js functionality in Swift. Native ABI parsing and smart contract interactions on Ethereum network.
Stars: ✭ 462 (+2466.67%)
Mutual labels:  json-rpc
aiohttp-rpc
A simple JSON-RPC for aiohttp
Stars: ✭ 22 (+22.22%)
Mutual labels:  json-rpc
Libjson Rpc Cpp
C++ framework for json-rpc (json remote procedure call)
Stars: ✭ 653 (+3527.78%)
Mutual labels:  json-rpc
scala-json-rpc
Let your servers and clients communicate over function calls! JSON-RPC 2.0 library for Scala and Scala.js
Stars: ✭ 38 (+111.11%)
Mutual labels:  json-rpc
Atom Languageclient
Language Server Protocol support for Atom (the basis of Atom-IDE)
Stars: ✭ 385 (+2038.89%)
Mutual labels:  json-rpc
Kodirpc
Kodi JSON-RPC API/v6 Wrapper in C#
Stars: ✭ 5 (-72.22%)
Mutual labels:  json-rpc
Btc Rpc Explorer
Database-free, self-hosted Bitcoin explorer, via RPC to Bitcoin Core.
Stars: ✭ 699 (+3783.33%)
Mutual labels:  json-rpc
Xehentai
Doujinshi downloader 绅士漫画下载
Stars: ✭ 504 (+2700%)
Mutual labels:  json-rpc

JSON RPC

NPM version NPM downloads Build status Test coverage

Tiny, mostly compliant JSON-RPC 2.0 implementation.

This package intentionally doesn't implement the "arguments" form of request parameters. This is when the input params can be an object or an ordered array representing the object. Instead, you can pass any JSON params over the wire.

Installation

npm install @borderlesslabs/json-rpc --save

Usage

This package makes no assumptions about the transportation layer, for client or server.

Methods

type Methods = {
  hello: {
    request: {};
    response: string;
  };
  echo: {
    request: { arg: string };
    response: string;
  };
};

Server

The server accepts a dictionary of resolvers.

import { createServer } from "@borderlesslabs/json-rpc";

const server = createServer<Methods>({
  hello: _ => "Hello World!",
  echo: ({ arg }) => arg
});

const res = await server({
  jsonrpc: "2.0",
  id: "test",
  method: "hello"
}); //=> { jsonrpc: "2.0", id: "test", result: "Hello World!" }

Client

The client accepts a function to send the JSON-RPC request.

import { createClient } from "@borderlesslabs/json-rpc";

const client = createClient(async payload => {
  const res = await fetch("...", {
    method: "POST",
    body: JSON.stringify(payload),
    headers: {
      "Content-Type": "application/json"
    }
  });

  return res.json();
});

const result = await client({
  method: "hello",
  params: {}
}); //=> "Hello World!"

const results = await client.many([
  {
    method: "hello",
    params: {}
  },
  {
    method: "echo",
    params: { arg: "Test" }
  }
]); //=> ["Hello World!", "Test"]

License

MIT

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].