Documentation
¶
Index ¶
- Constants
- type ShipClient
- func (c *ShipClient) Close() *ShipClientError
- func (c *ShipClient) Connect(host string) error
- func (c *ShipClient) ConnectURL(url url.URL) error
- func (c *ShipClient) IsOpen() bool
- func (c *ShipClient) Read() *ShipClientError
- func (c *ShipClient) SendBlocksRequest() error
- func (c *ShipClient) SendCloseMessage() *ShipClientError
- func (c *ShipClient) SendStatusRequest() error
- type ShipClientError
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 ¶
func (*ShipClientError) Error ¶
func (e *ShipClientError) Error() string
Click to show internal directories.
Click to hide internal directories.