server

package
Version: v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2019 License: Apache-2.0 Imports: 17 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrInvalidNodeName node name does not follow requirements
	ErrInvalidNodeName = errors.New("node name is invalid")
)

Functions

This section is empty.

Types

type Config

type Config struct {
	MQTT     configuration.MqttConfig
	Acceptor configuration.AcceptorConfig

	// Configuration of persistence provider
	Persistence vlpersistence.IFace

	// OnDuplicate notify if there is attempt connect client with id that already exists and active
	// If not not set than defaults to mock function
	OnDuplicate func(string, bool)

	// TransportStatus user provided callback to track transport status
	// If not set than defaults to mock function
	TransportStatus func(id string, status string)

	Health healthcheck.Checks

	// NodeName
	NodeName string
}

Config configuration of the MQTT server

type Server

type Server interface {
	// ListenAndServe configures transport according to provided config
	// This is non blocking function. It returns nil if listener started
	// or error if any happened during configuration.
	// Transport status reported over TransportStatus callback in server configuration
	ListenAndServe(interface{}) error

	// Shutdown terminates the server by shutting down all the client connections and closing
	// configured listeners. It does full clean up of the resources and
	Shutdown() error
}

Server server API

func NewServer

func NewServer(config Config) (Server, error)

NewServer allocate server object

Source Files

Jump to

Keyboard shortcuts

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