client

package
v0.0.0-...-81741d2 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2024 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func OnBroadcast

func OnBroadcast(ctx context.Context, client *Client) (chan Broadcast, error)

OnBroadcast listens for ReachView "broadcast" messages

func OnMessage

func OnMessage[T any](ctx context.Context, client *Client, mType string) (chan T, error)

Types

type Broadcast

type Broadcast struct {
	Name    string `mapstructure:"name" json:"name"`
	Payload any    `mapstructure:"payload" json:"payload"`
}

Broadcast is a broadcasted message containing module realtime informations.

type Client

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

func NewClient

func NewClient(addr string, funcs ...OptionFunc) *Client

func (*Client) Alive

func (c *Client) Alive(ctx context.Context) (bool, error)

Alive implements protocol.Operations.

func (*Client) Close

func (c *Client) Close(ctx context.Context) error

Close implements protocol.Operations.

func (*Client) Configuration

func (c *Client) Configuration(ctx context.Context) (any, error)

Configuration implements protocol.Operations.

func (*Client) Connect

func (c *Client) Connect(ctx context.Context) error

Connect implements protocol.Operations.

func (*Client) Emit

func (c *Client) Emit(ctx context.Context, mType string, message any) error

Emit implements protocol.Operations.

func (*Client) GetBaseInfo

func (c *Client) GetBaseInfo(ctx context.Context) (*protocol.BaseInfo, error)

GetBaseInfo implements protocol.Operations.

func (*Client) On

func (c *Client) On(ctx context.Context, messageType string) (chan any, error)

On implements protocol.Operations.

func (*Client) Protocol

func (*Client) Reboot

func (c *Client) Reboot(ctx context.Context) error

Reboot implements protocol.Operations.

func (*Client) SetBase

func (c *Client) SetBase(ctx context.Context, funcs ...protocol.SetBaseOptionFunc) error

SetBase implements protocol.Operations.

func (*Client) Version

func (c *Client) Version(ctx context.Context) (string, bool, error)

Version implements protocol.Operations.

type OptionFunc

type OptionFunc func(opts *Options)

func WithAvailableTimeout

func WithAvailableTimeout(timeout time.Duration) OptionFunc

func WithDial

func WithDial(dial protocol.DialFunc) OptionFunc

func WithFallbackProtocol

func WithFallbackProtocol(identifier protocol.Identifier) OptionFunc

func WithLogger

func WithLogger(logger logger.Logger) OptionFunc

func WithPreferredProtocol

func WithPreferredProtocol(identifier protocol.Identifier) OptionFunc

func WithProtocols

func WithProtocols(protocols *protocol.Registry) OptionFunc

type Options

type Options struct {
	Protocols         *protocol.Registry
	PreferredProtocol protocol.Identifier
	FallbackProtocol  protocol.Identifier
	AvailableTimeout  time.Duration
	Logger            logger.Logger
	Dial              protocol.DialFunc
}

func NewOptions

func NewOptions(funcs ...OptionFunc) *Options

Directories

Path Synopsis
v1
v2

Jump to

Keyboard shortcuts

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