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 ¶
- type Client
- func (c *Client) SubscribeBeats2(pos string) (*common.Subscription[*subscriptions.Beat2Message], error)
- func (c *Client) SubscribeBlocks(pos string) (*common.Subscription[*subscriptions.BlockMessage], error)
- func (c *Client) SubscribeEvents(pos string, filter *subscriptions.EventFilter) (*common.Subscription[*subscriptions.EventMessage], error)
- func (c *Client) SubscribeTransfers(pos string, filter *subscriptions.TransferFilter) (*common.Subscription[*subscriptions.TransferMessage], error)
- func (c *Client) SubscribeTxPool(txID *thor.Bytes32) (*common.Subscription[*subscriptions.PendingTxIDMessage], error)
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 ¶
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 ¶
func (c *Client) SubscribeTransfers(pos string, filter *subscriptions.TransferFilter) (*common.Subscription[*subscriptions.TransferMessage], error)
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.