client

package
Version: v0.0.0-...-a3b6696 Latest Latest
Warning

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

Go to latest
Published: May 31, 2021 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package client

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewConfig

func NewConfig(name string) (interface{}, error)

func Register

func Register(name string, newConfig ConfigFactoryFunc, newClient FactoryFunc)

Types

type ConfigFactoryFunc

type ConfigFactoryFunc func() interface{}

type FactoryFunc

type FactoryFunc func(
	ctx context.Context,
	handleCmd types.AgentCmdHandleFunc,
	cfg interface{},
) (Interface, error)

type Interface

type Interface interface {
	// Context of this client
	Context() context.Context

	// Connect to server/broker
	Connect(dialCtx context.Context) error

	// Start internal logic to get prepared for communicating with aranya
	// usually send online state message
	Start(appCtx context.Context) error

	// PostMsg to aranya
	PostMsg(msg *aranyagopb.Msg) error

	// Close this client
	Close() error

	// MaxPayloadSize of a single message for this client
	MaxPayloadSize() int
}

func NewClient

func NewClient(
	ctx context.Context,
	name string,
	handleCmd types.AgentCmdHandleFunc,
	config interface{},
) (Interface, error)

Directories

Path Synopsis
Package nats provides connectivity implementation based on nats client
Package nats provides connectivity implementation based on nats client

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL