types

package
v8.0.2 Latest Latest
Warning

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

Go to latest
Published: Jun 27, 2022 License: ISC Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrWsClosed is the error message when a websocket.(*Conn).Close tries to
	// close an already closed connection. See Go's src/internal/poll/fd.go.
	ErrWsClosed = "use of closed network connection"
)
View Source
var Subscriptions = map[string]HubSignal{
	"newblock":       SigNewBlock,
	"mempool":        SigMempoolUpdate,
	"ping":           SigPingAndUserCount,
	"newtxs":         SigNewTxs,
	"address":        SigAddressTx,
	"blockchainSync": SigSyncStatus,
}

Functions

func IsIOTimeoutErr

func IsIOTimeoutErr(err error) bool

IsIOTimeoutErr checks if the passed error indicates an I/O timeout error.

func IsTemporaryErr

func IsTemporaryErr(err error) bool

IsTemporaryErr checks if the passed error indicates a transient error.

func IsWSClosedErr

func IsWSClosedErr(err error) (closedErr bool)

IsWSClosedErr checks if the passed error indicates a closed websocket connection.

Types

type AddressMessage

type AddressMessage struct {
	Address string `json:"address"`
	TxHash  string `json:"transaction"`
}

func (AddressMessage) String

func (am AddressMessage) String() string

type HangUp

type HangUp struct{}

type HubMessage

type HubMessage struct {
	Signal HubSignal
	Msg    interface{}
}

func (HubMessage) IsValid

func (m HubMessage) IsValid() bool

func (HubMessage) String

func (m HubMessage) String() string

type HubSignal

type HubSignal int
const (
	SigSubscribe HubSignal = iota
	SigUnsubscribe
	SigDecodeTx
	SigGetMempoolTxs
	SigSendTx
	SigVersion
	SigNewBlock
	SigMempoolUpdate
	SigPingAndUserCount
	SigNewTx
	SigNewTxs
	SigAddressTx
	SigSyncStatus
	SigByeNow
	SigUnknown
)

These are the different signal types used for passing messages between the client and server, and internally between the pubsub and websocket hubs.

func ValidateSubscription

func ValidateSubscription(event string) (sub HubSignal, msg interface{}, valid bool)

func (HubSignal) IsValid

func (s HubSignal) IsValid() bool

func (HubSignal) String

func (s HubSignal) String() string

type RequestMessage

type RequestMessage struct {
	RequestId int64  `json:"request_id"`
	Message   string `json:"message"`
}

type ResponseMessage

type ResponseMessage struct {
	Success        bool   `json:"success"`
	RequestEventId string `json:"request_event"`
	RequestId      int64  `json:"request_id"`
	Data           string `json:"data"`
}

type TxList

type TxList []*exptypes.MempoolTx

type Ver

type Ver struct {
	Major uint32 `json:"major"`
	Minor uint32 `json:"minor"`
	Patch uint32 `json:"patch"`
}

Ver is a json tagged version type.

func NewVer

func NewVer(major, minor, patch uint32) Ver

NewVer creates a Ver from the major/minor/patch version components.

func (Ver) String

func (v Ver) String() string

String implements Stringer for Ver.

type WebSocketMessage

type WebSocketMessage struct {
	EventId string          `json:"event"`
	Message json.RawMessage `json:"message"`
}

WebSocketMessage represents the JSON object used to send and receive typed messages to the web client.

Jump to

Keyboard shortcuts

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