websocket

package
v0.0.0-...-cb7fc92 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrIncorrectId = errors.New("incorrect id")

Functions

func NewClient

func NewClient(cfg *WebsocketConfig) *client.XRPLClient

Types

type ErrorWebsocketClientXrplResponse

type ErrorWebsocketClientXrplResponse struct {
	Type    string
	Request map[string]any
}

func (*ErrorWebsocketClientXrplResponse) Error

type WebSocketClientXrplResponse

type WebSocketClientXrplResponse struct {
	ID        int                          `json:"id"`
	Status    string                       `json:"status"`
	Type      string                       `json:"type"`
	Error     string                       `json:"error,omitempty"`
	Result    json.RawMessage              `json:"result,omitempty"`
	Value     map[string]any               `json:"value,omitempty"`
	Warning   string                       `json:"warning,omitempty"`
	Warnings  []client.XRPLResponseWarning `json:"warnings,omitempty"`
	Forwarded bool                         `json:"forwarded,omitempty"`
}

func (*WebSocketClientXrplResponse) GetError

func (r *WebSocketClientXrplResponse) GetError() error

func (*WebSocketClientXrplResponse) GetResult

func (r *WebSocketClientXrplResponse) GetResult(v any) error

type WebsocketClient

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

func NewWebsocketClient

func NewWebsocketClient(cfg *WebsocketConfig) *WebsocketClient

Creates a new websocket client with cfg.

This client will open and close a websocket connection for each request.

func (*WebsocketClient) Address

func (c *WebsocketClient) Address() string

func (*WebsocketClient) Faucet

func (c *WebsocketClient) Faucet() string

func (*WebsocketClient) SendRequest

func (c *WebsocketClient) SendRequest(req client.XRPLRequest) (client.XRPLResponse, error)

type WebsocketConfig

type WebsocketConfig struct {
	URL    string
	Faucet string
}

func NewWebsocketConfig

func NewWebsocketConfig(url string, opts ...WebsocketConfigOpt) (*WebsocketConfig, error)

type WebsocketConfigOpt

type WebsocketConfigOpt func(c *WebsocketConfig)

Jump to

Keyboard shortcuts

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