ws

package
v1.18.69 Latest Latest
Warning

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

Go to latest
Published: May 10, 2023 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BankStats

type BankStats struct {
	NumTransactionEntries     uint64 `json:"numTransactionEntries"`
	NumSuccessfulTransactions uint64 `json:"numSuccessfulTransactions"`
	NumFailedTransactions     uint64 `json:"numFailedTransactions"`
	MaxTransactionsPerEntry   uint64 `json:"maxTransactionsPerEntry"`
}

type Client

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

func Connect

func Connect(ctx context.Context, rpcEndpoint string) (c *Client, err error)

Connect creates a new websocket client connecting to the provided endpoint.

func ConnectWithOptions

func ConnectWithOptions(ctx context.Context, rpcEndpoint string, opt *Options) (c *Client, err error)

ConnectWithOptions creates a new websocket client connecting to the provided endpoint with a http header if available The http header can be helpful to pass basic authentication params as prescribed ref https://github.com/gorilla/websocket/issues/209

func (*Client) Close

func (c *Client) Close()

func (*Client) SlotSubscribe

func (cl *Client) SlotSubscribe() (*SlotSubscription, error)

SlotSubscribe subscribes to receive notification anytime a slot is processed by the validator.

func (*Client) SlotsUpdatesSubscribe

func (cl *Client) SlotsUpdatesSubscribe() (*SlotsUpdatesSubscription, error)

SlotsUpdatesSubscribe (UNSTABLE) subscribes to receive a notification from the validator on a variety of updates on every slot.

This subscription is unstable; the format of this subscription may change in the future and it may not always be supported.

type Options

type Options struct {
	HttpHeader http.Header
}

type SlotResult

type SlotResult struct {
	Parent uint64 `json:"parent"`
	Root   uint64 `json:"root"`
	Slot   uint64 `json:"slot"`
}

type SlotSubscription

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

func (*SlotSubscription) Recv

func (sw *SlotSubscription) Recv() (*SlotResult, error)

func (*SlotSubscription) Unsubscribe

func (sw *SlotSubscription) Unsubscribe()

type SlotsUpdatesResult

type SlotsUpdatesResult struct {
	// The parent slot.
	Parent uint64 `json:"parent"`
	// The newly updated slot.
	Slot uint64 `json:"slot"`
	// The Unix timestamp of the update.
	Timestamp *int64 `json:"timestamp"`
	// The update type.
	Type SlotsUpdatesType `json:"type"`
	// Extra stats provided when a bank is frozen.
	Stats *BankStats `json:"stats"`
}

type SlotsUpdatesSubscription

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

func (*SlotsUpdatesSubscription) Recv

func (*SlotsUpdatesSubscription) Unsubscribe

func (sw *SlotsUpdatesSubscription) Unsubscribe()

type SlotsUpdatesType

type SlotsUpdatesType string
const (
	SlotsUpdatesFirstShredReceived     SlotsUpdatesType = "firstShredReceived"
	SlotsUpdatesCompleted              SlotsUpdatesType = "completed"
	SlotsUpdatesCreatedBank            SlotsUpdatesType = "createdBank"
	SlotsUpdatesFrozen                 SlotsUpdatesType = "frozen"
	SlotsUpdatesDead                   SlotsUpdatesType = "dead"
	SlotsUpdatesOptimisticConfirmation SlotsUpdatesType = "optimisticConfirmation"
	SlotsUpdatesRoot                   SlotsUpdatesType = "root"
)

type Subscription

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

func (*Subscription) Recv

func (s *Subscription) Recv() (interface{}, error)

func (*Subscription) Unsubscribe

func (s *Subscription) Unsubscribe()

Jump to

Keyboard shortcuts

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