talira

json_rpc_2

JSON-RPC 2.0 clients, servers and peers in Dart

open sourceBSD-3-Clausefree

json_rpc_2 is a Dart package from the Dart team that implements the JSON-RPC 2.0 specification. A Server registers methods that clients call, with a Parameters object that validates arguments and rejects invalid requests; a Client sends requests and notifications and handles the responses; and a Peer is both at once, routing each message from the other end for two-way communication. It works over any stream channel of strings, such as a WebSocket. Part of the dart-lang/tools monorepo, published on pub.dev by tools.dart.dev under the BSD 3-Clause licence.

Problems it solves

  • call methods on a JSON-RPC 2.0 server from a Dart app
  • expose Dart functions over JSON-RPC to other programs
  • two-way JSON-RPC over a WebSocket in Dart

Features

  • JSON-RPC 2.0 server with methods registered by name
  • Parameters object that validates arguments and rejects invalid requests
  • client for requests and notifications
  • Peer class that is both client and server for two-way communication
  • runs over any StreamChannel, such as a WebSocket