internal

package
v0.0.11 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2022 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type RPCError

type RPCError struct {
	Code    int64  `json:"code" msgpack:"code"`
	Message string `json:"message,omitempty" msgpack:"message,omitempty"`
}

RPCError represents a JSON-RPC error

func (*RPCError) Error

func (r *RPCError) Error() string

type RPCNotification

type RPCNotification struct {
	ID     any    `json:"id" msgpack:"id"`
	Method string `json:"method,omitempty" msgpack:"method,omitempty"`
	Params []any  `json:"params,omitempty" msgpack:"params,omitempty"`
}

RPCNotification represents an outgoing JSON-RPC notification

type RPCRawResponse

type RPCRawResponse struct {
	// contains filtered or unexported fields
}

func CreateRPCRawResponse

func CreateRPCRawResponse(data []byte) *RPCRawResponse

func (*RPCRawResponse) Error

func (res *RPCRawResponse) Error() error

Error returns the error we discovered in the rpc response, or the error we encountered while decoding

func (*RPCRawResponse) HasError

func (res *RPCRawResponse) HasError() bool

HasError Check if we have an error set

func (*RPCRawResponse) HasInternalError

func (res *RPCRawResponse) HasInternalError() bool

HasInternalError Check if we have an internal error set

func (*RPCRawResponse) Id

func (res *RPCRawResponse) Id() string

func (*RPCRawResponse) RawData

func (res *RPCRawResponse) RawData() []byte

func (*RPCRawResponse) Result

func (res *RPCRawResponse) Result() *RpcResultData

type RPCRequest

type RPCRequest struct {
	ID     any    `json:"id" msgpack:"id"`
	Async  bool   `json:"async,omitempty" msgpack:"async,omitempty"`
	Method string `json:"method,omitempty" msgpack:"method,omitempty"`
	Params []any  `json:"params,omitempty" msgpack:"params,omitempty"`
}

RPCRequest represents an incoming JSON-RPC request

type RPCResponse

type RPCResponse struct {
	ID     any       `json:"id" msgpack:"id"`
	Error  *RPCError `json:"error,omitempty" msgpack:"error,omitempty"`
	Result any       `json:"result,omitempty" msgpack:"result,omitempty"`
}

RPCResponse represents an outgoing JSON-RPC response

type RpcResultData

type RpcResultData struct {
	Result []byte
	Type   jsonparser.ValueType
}

type WS added in v0.0.11

type WS struct {
	// contains filtered or unexported fields
}

func NewWebsocket

func NewWebsocket(url string, timeout ...*Config.DbTimeoutConfig) (*WS, error)

func (*WS) Close added in v0.0.11

func (ws *WS) Close() error

func (*WS) NewContext added in v0.0.11

func (ws *WS) NewContext() (context.Context, context.CancelFunc)

func (*WS) Once added in v0.0.11

func (ws *WS) Once(id, method string) <-chan responseValue

Once Subscribe to once()

func (*WS) Send added in v0.0.11

func (ws *WS) Send(id string, method string, params []any)

func (*WS) When added in v0.0.11

func (ws *WS) When(id, method string) <-chan responseValue

When Subscribe to when()

Jump to

Keyboard shortcuts

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