eos_ship_client

package module
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2022 License: MIT Imports: 6 Imported by: 0

README

Eos SHIP Client

Client Implementation of eosio state-history websocket.

Install package
go get -u github.com/eosswedenorg-go/eos-ship-client@latest
Examples
Author

Henrik Hautakoski - Sw/eden - henrik@eossweden.org

Documentation

Index

Constants

View Source
const (
	ErrNotConnected = 1
	ErrSockRead     = 2
	ErrSendClose    = 3
	ErrACK          = 4
	ErrParse        = 5
)
View Source
const NULL_BLOCK_NUMBER uint32 = 0xffffffff

Variables

This section is empty.

Functions

This section is empty.

Types

type ShipClient

type ShipClient struct {

	// Block to start receiving notifications on.
	StartBlock uint32

	// Block to end receiving notifications on.
	EndBlock uint32

	// if only irreversible blocks should be sent.
	IrreversibleOnly bool

	// Max number of non-ACKed messages that may be sent.
	MaxMessagesInFlight uint32

	// Callback functions
	InitHandler   func(*eos.ABI)
	BlockHandler  func(*ship.GetBlocksResultV0)
	TraceHandler  func([]*ship.TransactionTraceV0)
	StatusHandler func(*ship.GetStatusResultV0)
	CloseHandler  func()
	// contains filtered or unexported fields
}

func NewClient

func NewClient(startBlock uint32, endBlock uint32, irreversibleOnly bool) *ShipClient

Create a new client

func (*ShipClient) Close

func (c *ShipClient) Close() *ShipClientError

Close the socket on the client side.

NOTE: This method closes the underlying network connection without sending or waiting for a close message.

func (*ShipClient) Connect

func (c *ShipClient) Connect(host string) error

Connect the client to a ship node

func (*ShipClient) ConnectURL added in v0.1.1

func (c *ShipClient) ConnectURL(url url.URL) error

Connect the client to a ship node

func (*ShipClient) IsOpen

func (c *ShipClient) IsOpen() bool

Returns true if the websocket connection is open. false otherwise.

func (*ShipClient) Read

func (c *ShipClient) Read() *ShipClientError

Read messages from the client.

func (*ShipClient) SendBlocksRequest

func (c *ShipClient) SendBlocksRequest() error

Send a block request to the ship server. This tells the server to start sending blocks to the client.

func (*ShipClient) SendCloseMessage

func (c *ShipClient) SendCloseMessage() *ShipClientError

Sends a close message to the server. indicating that the client wants to terminate the connection.

func (*ShipClient) SendStatusRequest added in v0.1.1

func (c *ShipClient) SendStatusRequest() error

Send a status request to the ship server. This tells the server to start sending status message to the client.

type ShipClientError

type ShipClientError struct {
	Type int
	Text string
}

func (*ShipClientError) Error

func (e *ShipClientError) Error() string

Directories

Path Synopsis
examples
basic command

Jump to

Keyboard shortcuts

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