rpctypes

package
v0.0.0-...-a4757fd Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2018 License: Apache-2.0, Apache-2.0, Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SocketType

func SocketType(listenAddr string) string

---------------------------------------- sockets

Determine if its a unix or tcp socket. If tcp, must specify the port; `0.0.0.0` will return incorrectly as "unix" since there's no port

Types

type RPCRequest

type RPCRequest struct {
	JSONRPC string        `json:"jsonrpc"`
	ID      string        `json:"id"`
	Method  string        `json:"method"`
	Params  []interface{} `json:"params"`
}

func NewRPCRequest

func NewRPCRequest(id string, method string, params []interface{}) RPCRequest

type RPCResponse

type RPCResponse struct {
	JSONRPC string      `json:"jsonrpc"`
	ID      string      `json:"id"`
	Result  interface{} `json:"result"`
	Error   string      `json:"error"`
}

func NewRPCResponse

func NewRPCResponse(id string, res interface{}, err string) RPCResponse

type Result

type Result interface {
}

Result is a generic interface. Applications should register type-bytes like so:

var _ = wire.RegisterInterface(

struct{ Result }{},
wire.ConcreteType{&ResultGenesis{}, ResultTypeGenesis},
wire.ConcreteType{&ResultBlockchainInfo{}, ResultTypeBlockchainInfo},
...

)

type WSRPCConnection

type WSRPCConnection interface {
	GetRemoteAddr() string
	GetEventSwitch() events.EventSwitch
	WriteRPCResponse(resp RPCResponse)
	TryWriteRPCResponse(resp RPCResponse) bool
}

*wsConnection implements this interface.

type WSRPCContext

type WSRPCContext struct {
	Request RPCRequest
	WSRPCConnection
}

websocket-only RPCFuncs take this as the first parameter.

Jump to

Keyboard shortcuts

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