server

package
v0.0.0-...-b743a0b Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2020 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Options

type Options struct {
	// API Server
	// The port used for the API server
	Port string

	// Enable o disable the UI dashboard
	UI bool

	// The port used for enter to UI dashboard
	PortUI string

	// Broker server
	// The Broker server URL
	BrokerURL string

	// Use external broker server (default: false) or internal nats server (true)
	BrokerExternal bool

	// Broker access key
	BrokerAccessKey string

	// Broker secret key
	BrokerSecretKey string

	// Storage
	// Endpoint S3 URL
	StorageURL string

	// Storage access key
	StorageAccessKey string

	// Storage secret key
	StorageSecretKey string

	// Database
	// Database URL
	DatabaseURL string

	// Database access key
	DatabaseAccessKey string

	// Database secret key
	DatabaseSecretKey string

	// Config path
	Config string
}

Options for API, broker server and UI dashboard

type Server

type Server struct {
	Port             string
	StorageAccessKey string
	StorageSecretKey string

	Opts Options

	HTTP       *echo.Echo
	Conn       *broker.Conn
	BrokerOpts []broker.Option

	// Static assets
	Static *packr.Box
	// contains filtered or unexported fields
}

func New

func New(port, storageAccessKey, storageSecretKey string) *Server

func (*Server) List

func (s *Server) List(msg *broker.Msg)

List get the list of devices

func (*Server) NotFoundHandler

func (s *Server) NotFoundHandler() http.Handler

func (*Server) Publish

func (s *Server) Publish(subj string, data []byte) error

Publish a message

func (*Server) Run

func (s *Server) Run()

func (*Server) Status

func (s *Server) Status(msg *broker.Msg)

Status get the status info

func (*Server) Subscribe

func (s *Server) Subscribe(subj string, f func(*broker.Msg)) (*broker.Subscription, error)

Subscribe a topic

func (*Server) Sync

func (s *Server) Sync(msg *broker.Msg)

Sync sync the media files

type User

type User struct {
	Username string `json:"username"`
	Password string `json:"password"`
	Hash     string `json:"hash"`
	Avatar   string `json:"avatar"`
}

Jump to

Keyboard shortcuts

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