ws

package
v0.0.0 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2024 License: Apache-2.0, UNKNOWN not legal advice Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrTimedOut                  = errors.New("context timed out")
	ErrRequestResponseIDMismatch = errors.New("ws request / response ID mismatch")
	ErrInvalidBatchResponse      = errors.New("invalid ws batch response size")
)

Functions

This section is empty.

Types

type Client

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

Client is a WebSocket client implementation

func NewClient

func NewClient(rpcURL string, opts ...Option) (*Client, error)

NewClient initializes and creates a new WS RPC client

func (*Client) Close

func (c *Client) Close() error

Close closes the WS client

func (*Client) SendBatch

func (c *Client) SendBatch(ctx context.Context, requests types.RPCRequests) (types.RPCResponses, error)

SendBatch sends a batch of RPC requests to the server

func (*Client) SendRequest

func (c *Client) SendRequest(ctx context.Context, request types.RPCRequest) (*types.RPCResponse, error)

SendRequest sends a single RPC request to the server

type Option

type Option func(*Client)

func WithLogger

func WithLogger(logger *slog.Logger) Option

WithLogger sets the WS client logger

Jump to

Keyboard shortcuts

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