transport

package
v0.0.0-...-38057b2 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2022 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

func (*HTTP) SetMaxConnsPerHost

func (h *HTTP) SetMaxConnsPerHost(count int)

SetMaxConnsPerHost sets the maximum number of connections that can be established with a host

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

	// SetMaxConnsPerHost sets the maximum number of connections that can be established with a host
	SetMaxConnsPerHost(count int)

	// 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, headers map[string]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