api

package
v1.0.35 Latest Latest
Warning

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

Go to latest
Published: Aug 4, 2021 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// WsHub is the websocket hub
	WsHub = NewHub()
)

Functions

func ShowUI

func ShowUI(rw http.ResponseWriter, req *http.Request)

ShowUI redirects to the '/ui/' virtual directory

Types

type Hub

type Hub struct {

	// Inbound messages from the connections.
	Broadcast chan []byte
	// contains filtered or unexported fields
}

Hub is a connection hub for websockets

func NewHub

func NewHub() *Hub

NewHub is a constructor for new connection Hubs

type Service

type Service struct {
	DB        *data.Manager
	StartTime time.Time
}

Service encapsulates API service operations

func (Service) GetAllConfig

func (service Service) GetAllConfig(rw http.ResponseWriter, req *http.Request)

GetAllConfig gets all config items

func (Service) GetConfig

func (service Service) GetConfig(rw http.ResponseWriter, req *http.Request)

GetConfig gets a specfic config item based on config item name

func (Service) RemoveConfig

func (service Service) RemoveConfig(rw http.ResponseWriter, req *http.Request)

RemoveConfig removes a specific config item

func (Service) SetConfig

func (service Service) SetConfig(rw http.ResponseWriter, req *http.Request)

SetConfig sets a specific config item

type SystemResponse

type SystemResponse struct {
	Message string      `json:"message"`
	Data    interface{} `json:"data"`
}

SystemResponse is a response for a system request

type WsHandler

type WsHandler struct {
	H *Hub
}

WsHandler websocket handler

func (WsHandler) ServeHTTP

func (wsh WsHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

Jump to

Keyboard shortcuts

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