zmq

package
v0.6.0-rc0 Latest Latest
Warning

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

Go to latest
Published: May 8, 2023 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package zmq reference is taken from https://github.com/joakimofv/go-bitcoindclient which is a go wrapper around official zmq package https://github.com/pebbe/zmq4

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrSubscribeDisabled         = errors.New("subscribe disabled (ZmqEndpoint was not set)")
	ErrSubscribeExited           = errors.New("subscription backend has exited")
	ErrSubscriptionAlreadyActive = errors.New("active subscription already exists")
)

Functions

This section is empty.

Types

type Client

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

Client is a client that provides methods for interacting with zmq4. Must be created with New and destroyed with Close. Clients are safe for concurrent use by multiple goroutines.

func New

func New(zmqEndpoint string, blockEventChan chan *types.BlockEvent, rpcClient *rpcclient.Client) (*Client, error)

New returns an initiated client, or an error.

func (*Client) Close

func (c *Client) Close() (err error)

Close terminates the client and releases resources.

func (*Client) SubscribeSequence

func (c *Client) SubscribeSequence() (err error)

SubscribeSequence subscribes to the ZMQ "sequence" messages as SequenceMsg items pushed onto the channel. Call cancel to cancel the subscription and let the client release the resources. The channel is closed when the subscription is canceled or when the client is closed.

type SequenceMsg

type SequenceMsg struct {
	Hash  [32]byte // use encoding/hex.EncodeToString() to get it into the RPC method string format.
	Event types.EventType
}

SequenceMsg is a subscription event coming from a "sequence" ZMQ message.

Jump to

Keyboard shortcuts

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