Help us shape the future of Go! Take the 2026 Go Developer Survey

jsonrpc

package
v0.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 31, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package jsonrpc writes and reads the JSON-RPC 2.0 request envelope. A JSON-RPC request in Flowi is an ordinary HTTP request whose JSON body is this envelope, so it carries headers, auth, hooks and checks like any other; this package is what an editor and the OpenRPC importer share.

Index

Constants

View Source
const Version = "2.0"

Version is the protocol version the envelope states.

Variables

This section is empty.

Functions

func Envelope

func Envelope(c Call) string

Envelope writes c as the JSON body to send, indented. An ID of digits is written as a number, any other as a string. Params that do not parse yet (a {{template}} outside quotes) are written as typed.

Types

type Call

type Call struct {
	Method string
	Params string
	ID     string
}

Call is a JSON-RPC request. Params is the JSON text of the parameters (an array or an object; it may hold {{templates}}), empty for none. ID is a number or a text; empty makes the call a notification, which has no id and gets no answer.

func Parse

func Parse(text string) (Call, bool)

Parse reads a JSON-RPC 2.0 request envelope. ok is false for anything else: text that is not JSON, not an object, or without "jsonrpc": "2.0" and a method name.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL