ws

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2025 License: MPL-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// SchemeWS represents WebSocket URI scheme
	SchemeWS reader.Scheme = "ws"
	// SchemeWSS represents WebSocket Secure URI scheme
	SchemeWSS reader.Scheme = "wss"

	// DefaultTimeout for WebSocket connection
	DefaultTimeout = 30 * time.Second
	// DefaultRetryAttempts for failed connections
	DefaultRetryAttempts = 3
	// DefaultRetryDelay between retry attempts
	DefaultRetryDelay = 1 * time.Second
	// DefaultPingInterval for WebSocket ping
	DefaultPingInterval = 30 * time.Second
	// DefaultPongWait for WebSocket pong response
	DefaultPongWait = 60 * time.Second
	// DefaultWriteWait for WebSocket write operations
	DefaultWriteWait = 10 * time.Second
)

Variables

This section is empty.

Functions

This section is empty.

Types

type WSConfig

type WSConfig struct {
	Timeout       time.Duration
	RetryAttempts int
	RetryDelay    time.Duration
	PingInterval  time.Duration
	PongWait      time.Duration
	WriteWait     time.Duration
	Headers       map[string]string
	TLSConfig     *tls.Config
}

WSConfig holds WebSocket client configuration

type WSReader

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

WSReader implements ConfReader for WebSocket-based configuration

func NewWSReader

func NewWSReader(uri string) (*WSReader, error)

NewWSReader creates a new WebSocket reader

func (*WSReader) Close

func (w *WSReader) Close() error

Close closes the reader and cleans up resources

func (*WSReader) Read

func (w *WSReader) Read(ctx context.Context) ([]byte, error)

Read reads configuration data from WebSocket endpoint

func (*WSReader) Subscribe

func (w *WSReader) Subscribe(ctx context.Context) (<-chan *reader.ReadEvent, error)

Subscribe subscribes to WebSocket for real-time updates

Jump to

Keyboard shortcuts

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