jsonrpc2

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2022 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Header       = '{'
	KeepAlive    = "rpc.keepalive"
	RequestType  = "request"
	ResponseType = "response"
	Version      = "2.0"
)
View Source
const (
	ErrorParser    = -32700 // jsonrpc2 解析消息失败
	InvalidRequest = -32600 // 无效的请求
	MethodNotFound = -32601 // 找不到方法
	InvalidParams  = -32602 // 无效的参数
	ErrorInternal  = -32603 // 内部错误
	Unknown        = -32004 // 未知的错误
)

Variables

This section is empty.

Functions

This section is empty.

Types

type BaseMessage

type BaseMessage struct {
	MessageType int               `json:"rpc_message_type"`
	Version     string            `json:"jsonrpc"`
	Id          uint64            `json:"id"`
	MetaData    map[string]string `json:"rpc_metadata"`
}

type Error

type Error struct {
	Code    int             `json:"code"`
	Message string          `json:"message"`
	Data    json.RawMessage `json:"data"`
}

type Request

type Request struct {
	BaseMessage
	RequestTrait
}

type RequestTrait

type RequestTrait struct {
	Method string          `json:"method"`
	Params json.RawMessage `json:"params"`
}

type Response

type Response struct {
	BaseMessage
	ResponseTrait
}

type ResponseTrait

type ResponseTrait struct {
	Result [][]byte `json:"result"`
	Error  *Error   `json:"error,omitempty"`
}

Jump to

Keyboard shortcuts

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