rpc

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: May 2, 2020 License: LGPL-3.0 Imports: 3 Imported by: 3

Documentation

Overview

Package rpc contains defines for rpc server and client.

Package rpc contains defines for rpc server and client.

Index

Constants

View Source
const (
	JsonrpcVersion         = "2.0"
	ServiceMethodSeparator = "_"

	ContentType = "application/json"
)
View Source
const (
	RPCPath       = "/rpc"
	WebSocketPath = "/ws"

	SubscribeMethodSuffix    = "_subscribe"
	UnsubscribeMethodSuffix  = "_unsubscribe"
	NotificationMethodSuffix = "_subscription"
)

Variables

View Source
var (
	// ErrNotificationsUnsupported is returned when the connection doesn't support notifications
	ErrNotificationsUnsupported = errors.New("notifications not supported")
	// ErrNotificationNotFound is returned when the notification for the given id is not found
	ErrSubscriptionNotFound = errors.New("subscription not found")
)

Functions

This section is empty.

Types

type JsonErrResponse

type JsonErrResponse struct {
	Version string      `json:"jsonrpc"`
	Id      interface{} `json:"id,omitempty"`
	Error   JsonError   `json:"error"`
}

type JsonError

type JsonError struct {
	Code    int         `json:"code"`
	Message string      `json:"message"`
	Data    interface{} `json:"data,omitempty"`
}

func (*JsonError) Error

func (err *JsonError) Error() string

func (*JsonError) ErrorCode

func (err *JsonError) ErrorCode() int

type JsonNotification

type JsonNotification struct {
	Version string           `json:"jsonrpc"`
	Method  string           `json:"method"`
	Params  JsonSubscription `json:"params"`
}

type JsonRequest

type JsonRequest struct {
	Method  string          `json:"method"`
	Version string          `json:"jsonrpc"`
	Id      json.RawMessage `json:"id,omitempty"`
	Payload json.RawMessage `json:"params,omitempty"`
}

type JsonSubscription

type JsonSubscription struct {
	Subscription string      `json:"subscription"`
	Result       interface{} `json:"result,omitempty"`
}

type JsonSuccessResponse

type JsonSuccessResponse struct {
	Version string      `json:"jsonrpc"`
	Id      interface{} `json:"id,omitempty"`
	Result  interface{} `json:"result"`
}

Directories

Path Synopsis
Package rpcclient contains implementations for net rpc client.
Package rpcclient contains implementations for net rpc client.
Package rpcserver contains implementations for net rpc server.
Package rpcserver contains implementations for net rpc server.

Jump to

Keyboard shortcuts

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