Documentation ¶
Overview ¶
Package junglebus is a Go client for interacting with GorillaPool's JungleBus
If you have any suggestions or comments, please feel free to open an issue on this GitHub repository!
By GorillaPool (https://githujb.com/GorillaPool)
Index ¶
- Variables
- type Client
- func (jb *Client) GetAddressTransactionDetails(ctx context.Context, address string) ([]*models.Transaction, error)
- func (jb *Client) GetAddressTransactions(ctx context.Context, address string) ([]*models.Address, error)
- func (jb *Client) GetBlockHeader(ctx context.Context, block string) (*models.BlockHeader, error)
- func (jb *Client) GetBlockHeaders(ctx context.Context, block string, limit uint) ([]*models.BlockHeader, error)
- func (jb *Client) GetTransaction(ctx context.Context, txID string) (*models.Transaction, error)
- func (jb *Client) GetTransport() *transports.TransportService
- func (jb *Client) IsDebug() bool
- func (jb *Client) SetDebug(debug bool)
- func (jb *Client) Subscribe(ctx context.Context, subscriptionID string, fromBlock uint64, ...) (*Subscription, error)
- func (jb *Client) SubscribeWithQueue(ctx context.Context, subscriptionID string, fromBlock uint64, fromPage uint64, ...) (*Subscription, error)
- func (jb *Client) Unsubscribe() (err error)
- type ClientOps
- type EventHandler
- type StatusCode
- type Subscription
Constants ¶
This section is empty.
Variables ¶
var DefaultServer = "junglebus.gorillapool.io"
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct { transports.TransportService // contains filtered or unexported fields }
Client is the go-junglebus client
func (*Client) GetAddressTransactionDetails ¶
func (jb *Client) GetAddressTransactionDetails(ctx context.Context, address string) ([]*models.Transaction, error)
GetAddressTransactionDetails get full transaction data for the given address
func (*Client) GetAddressTransactions ¶
func (jb *Client) GetAddressTransactions(ctx context.Context, address string) ([]*models.Address, error)
GetAddressTransactions get transaction meta data for the given address
func (*Client) GetBlockHeader ¶
GetBlockHeader get a block header from JungleBus
func (*Client) GetBlockHeaders ¶
func (jb *Client) GetBlockHeaders(ctx context.Context, block string, limit uint) ([]*models.BlockHeader, error)
GetBlockHeaders get a list of block headers from JungleBus
func (*Client) GetTransaction ¶
func (*Client) GetTransport ¶
func (jb *Client) GetTransport() *transports.TransportService
GetTransport returns the current transport service
func (*Client) Subscribe ¶
func (jb *Client) Subscribe(ctx context.Context, subscriptionID string, fromBlock uint64, eventHandler EventHandler) (*Subscription, error)
func (*Client) SubscribeWithQueue ¶ added in v0.2.12
func (jb *Client) SubscribeWithQueue(ctx context.Context, subscriptionID string, fromBlock uint64, fromPage uint64, eventHandler EventHandler, queueSize uint32) (*Subscription, error)
func (*Client) Unsubscribe ¶
type ClientOps ¶
type ClientOps func(c *Client)
ClientOps are used for client options
func WithDebugging ¶
WithDebugging will set whether to turn debugging on
func WithHTTPClient ¶
WithHTTPClient will overwrite the default client with a custom client
func WithVersion ¶
WithVersion will set the API version to use (v1 is default)
type EventHandler ¶
type EventHandler struct { OnTransaction func(tx *models.TransactionResponse) OnMempool func(tx *models.TransactionResponse) OnStatus func(response *models.ControlResponse) OnError func(err error) // contains filtered or unexported fields }
func (*EventHandler) OnPublish ¶
func (e *EventHandler) OnPublish(event centrifuge.PublicationEvent)
type StatusCode ¶
type StatusCode uint
StatusCode defines the codes that can be returned from the control channel of a subscription
var ( // StatusConnecting is when connecting to a server StatusConnecting StatusCode = 1 // StatusConnected is when connected to a server StatusConnected StatusCode = 2 // StatusJoin is when joining to a server StatusJoin StatusCode = 3 // StatusLeave is when leaving to a server StatusLeave StatusCode = 4 // StatusDisconnecting is when disconnecting from a server StatusDisconnecting StatusCode = 10 // StatusDisconnected is when disconnected from a server StatusDisconnected StatusCode = 11 // StatusSubscribing is when subscribing to a server StatusSubscribing StatusCode = 20 // StatusSubscribed is when subscribed on a server StatusSubscribed StatusCode = 21 // StatusUnsubscribed is when unsubscribed on a server StatusUnsubscribed StatusCode = 29 // SubscriptionWait is sent when the server is waiting for a new block to be ready to send transactions SubscriptionWait StatusCode = 100 // SubscriptionError is sent when an error was encountered SubscriptionError StatusCode = 101 // SubscriptionPageDone is sent when a block-page is done processing SubscriptionPageDone StatusCode = 199 // SubscriptionBlockDone is sent when a block is done processing SubscriptionBlockDone StatusCode = 200 // SubscriptionReorg is sent when a reorg is initialized SubscriptionReorg StatusCode = 300 // StatusError is sent when an error is found StatusError StatusCode = 999 )
type Subscription ¶
type Subscription struct { SubscriptionID string FromBlock uint64 EventHandler EventHandler // contains filtered or unexported fields }
func (*Subscription) Unsubscribe ¶
func (s *Subscription) Unsubscribe() (err error)