Documentation ¶
Index ¶
- Variables
- func IsCloseError(err error, codes ...int) bool
- type Client
- func (c *Client) Close() error
- func (c *Client) Connect(ctx context.Context, url string) error
- func (c *Client) IsOpen() bool
- func (c *Client) Read() (ship.Result, error)
- func (c *Client) Shutdown(ctx context.Context) error
- func (c *Client) Write(req ship.Request) error
- func (c *Client) WriteClose(code int, reason string) error
- type Option
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func IsCloseError ¶ added in v0.2.6
Types ¶
type Client ¶
type Client struct { // True if we care about the abi. FetchABI bool // Pointer to the ABI ABI *chain.Abi // contains filtered or unexported fields }
Client is a low-level SHIP websocket client.
func (*Client) Close ¶
Close the socket on the client side.
NOTE: This method closes the underlying network connection without sending any close message.
func (*Client) Connect ¶
Connect connects to a ship node
Url must be of the form schema://host[:port] and schema should be "ws" or "wss"
The provided Context must be non-nil. If the context expires or is canceled before the connection is complete, an error is returned.
func (*Client) Read ¶
Read a result message from the websocket.
This function will block until atleast one message is read or an error occurred.
func (*Client) Shutdown ¶
Shutdown closes the connection gracefully by sending a Close handshake. This function will block until a close message is received from the server an error occure or context is canceled.
Note: Shutdown will not read anything from the stream. it assumes there is some other thread that reads and process the close message returned from the server