wsclient

package
v2.2.1-rc.2 Latest Latest
Warning

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

Go to latest
Published: Feb 4, 2025 License: LGPL-3.0 Imports: 8 Imported by: 0

Documentation

Overview

Package wsclient provides a WebSocket client for subscribing to various VeChainThor blockchain events. It enables subscriptions to blocks, transfers, events, and other updates via WebSocket.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client represents a WebSocket client that connects to the VeChainThor blockchain via WebSocket for subscribing to blockchain events and updates.

func NewClient

func NewClient(url string) (*Client, error)

NewClient creates a new WebSocket Client from the provided URL. The function parses the URL, determines the appropriate WebSocket scheme (ws or wss), and returns the client or an error if the URL is invalid.

func (*Client) SubscribeBeats2

func (c *Client) SubscribeBeats2(pos string) (*common.Subscription[*subscriptions.Beat2Message], error)

SubscribeBeats2 subscribes to Beat2 messages based on the provided query. It returns a Subscription that streams Beat2 messages or an error if the connection fails.

func (*Client) SubscribeBlocks

func (c *Client) SubscribeBlocks(pos string) (*common.Subscription[*subscriptions.BlockMessage], error)

SubscribeBlocks subscribes to block updates based on the provided query. It returns a Subscription that streams block messages or an error if the connection fails.

func (*Client) SubscribeEvents

func (c *Client) SubscribeEvents(pos string, filter *subscriptions.EventFilter) (*common.Subscription[*subscriptions.EventMessage], error)

SubscribeEvents subscribes to blockchain events based on the provided query. It returns a Subscription that streams event messages or an error if the connection fails.

func (*Client) SubscribeTransfers

SubscribeTransfers subscribes to transfer events based on the provided query. It returns a Subscription that streams transfer messages or an error if the connection fails.

func (*Client) SubscribeTxPool

func (c *Client) SubscribeTxPool(txID *thor.Bytes32) (*common.Subscription[*subscriptions.PendingTxIDMessage], error)

SubscribeTxPool subscribes to pending transaction pool updates based on the provided query. It returns a Subscription that streams pending transaction messages or an error if the connection fails.

Jump to

Keyboard shortcuts

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