transport

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2023 License: MPL-2.0 Imports: 13 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