snapclient

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2026 License: MIT Imports: 11 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DefaultRequestBurst = 10
	DefaultRequestRate  = rate.Every(time.Second / 2)
)

Functions

This section is empty.

Types

type Client

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

func New

func New(o *Options) *Client

func (*Client) Close

func (c *Client) Close() error

func (*Client) Listen

func (c *Client) Listen(ctx context.Context, n *Notifications) (chan error, error)

Passes a websocket closer channel or an error on initial setup

func (*Client) Send

func (c *Client) Send(ctx context.Context, method snapcast.RequestMethod, params interface{}) (*snapcast.Response, error)

type Notifications

type Notifications struct {
	MsgReaderErr chan error

	// Client
	ClientOnConnect        chan *snapcast.ClientOnConnect
	ClientOnDisconnect     chan *snapcast.ClientOnDisconnect
	ClientOnVolumeChanged  chan *snapcast.ClientOnVolumeChanged
	ClientOnLatencyChanged chan *snapcast.ClientOnLatencyChanged
	ClientOnNameChanged    chan *snapcast.ClientOnNameChanged
	// Group
	GroupOnMute          chan *snapcast.GroupOnMute
	GroupOnStreamChanged chan *snapcast.GroupOnStreamChanged
	GroupOnNameChanged   chan *snapcast.GroupOnNameChanged
	// Stream
	StreamOnUpdate     chan *snapcast.StreamOnUpdate
	StreamOnProperties chan *snapcast.StreamOnProperties
	// Server
	ServerOnUpdate chan *snapcast.ServerOnUpdate
}

type Options

type Options struct {
	Host        string
	RateLimiter *rate.Limiter
	// if secure then https & wss and used else http & ws protocols
	SecureConnection bool
	// HTTPClient is used for JSON-RPC requests and for the WebSocket upgrade
	// handshake. Supply an instrumented client (e.g. otelhttp) to add tracing.
	// If nil, a default client is used.
	HTTPClient *http.Client
}

Jump to

Keyboard shortcuts

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