rpctypes

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2017 License: Apache-2.0 Imports: 3 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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  *json.RawMessage `json:"params"` // must be map[string]interface{} or []interface{}
}

func ArrayToRequest

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

func MapToRequest

func MapToRequest(id string, method string, params map[string]interface{}) (RPCRequest, error)

func NewRPCRequest

func NewRPCRequest(id string, method string, params json.RawMessage) RPCRequest

type RPCResponse

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

func NewRPCResponse

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

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