transport

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2021 License: MPL-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrTimeout = fmt.Errorf("timeout")

ErrTimeout happens when the websocket requests times out

Functions

This section is empty.

Types

type Codec

type Codec interface {
	Read([]byte) ([]byte, error)
	Write([]byte) error
	Close() error
}

Codec is the codec to write and read messages

type HTTP

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

HTTP is an http transport

func (*HTTP) Call

func (h *HTTP) Call(method string, out interface{}, params ...interface{}) error

Call implements the transport interface

func (*HTTP) Close

func (h *HTTP) Close() error

Close implements the transport interface

type PubSubTransport

type PubSubTransport interface {
	// Subscribe starts a subscription to a new event
	Subscribe(method string, callback func(b []byte)) (func() error, error)
}

PubSubTransport is a transport that allows subscriptions

type Transport

type Transport interface {
	// Call makes a jsonrpc request
	Call(method string, out interface{}, params ...interface{}) error

	// Close closes the transport connection if necessary
	Close() error
}

Transport is an inteface for transport methods to send jsonrpc requests

func NewTransport

func NewTransport(url string) (Transport, error)

NewTransport creates a new transport object

Jump to

Keyboard shortcuts

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