server

package
v0.0.0-...-a8dc8ba Latest Latest
Warning

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

Go to latest
Published: Dec 28, 2019 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ChargeModeHandler

func ChargeModeHandler(lp api.LoadPoint) http.HandlerFunc

ChargeModeHandler updates charge mode

func CurrentChargeModeHandler

func CurrentChargeModeHandler(lp api.LoadPoint) http.HandlerFunc

CurrentChargeModeHandler returns current charge mode

func Dir

func Dir(useLocal bool, name string) http.FileSystem

Dir returns a http.Filesystem for the embedded assets on a given prefix dir. If useLocal is true, the filesystem's contents are instead used.

func FS

func FS(useLocal bool) http.FileSystem

FS returns a http.Filesystem for the embedded assets. If useLocal is true, the filesystem's contents are instead used.

func FSByte

func FSByte(useLocal bool, name string) ([]byte, error)

FSByte returns the named file from the embedded assets. If useLocal is true, the filesystem's contents are instead used.

func FSMustByte

func FSMustByte(useLocal bool, name string) []byte

FSMustByte is the same as FSByte, but panics if name is not present.

func FSMustString

func FSMustString(useLocal bool, name string) string

FSMustString is the string version of FSMustByte.

func FSString

func FSString(useLocal bool, name string) (string, error)

FSString is the string version of FSByte.

func IndexHandler

func IndexHandler(liveAssets bool) http.HandlerFunc

func JsonHandler

func JsonHandler(h http.Handler) http.Handler

JsonHandler is a middleware that decorates responses with JSON and CORS headers

func NewHttpd

func NewHttpd(url string, lp *core.LoadPoint, hub *SocketHub) *http.Server

NewHttpd creates HTTP server with configured routes for loadpoint

func RouteLogger

func RouteLogger(inner http.Handler) http.HandlerFunc

func ServeWebsocket

func ServeWebsocket(hub *SocketHub, w http.ResponseWriter, r *http.Request)

ServeWebsocket handles websocket requests from the peer.

func SocketHandler

func SocketHandler(hub *SocketHub) http.HandlerFunc

SocketHandler attaches websocket handler to uri

Types

type DebugLogger

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

func (DebugLogger) Write

func (d DebugLogger) Write(p []byte) (n int, err error)

type SocketClient

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

SocketClient is a middleman between the websocket connection and the hub.

type SocketHub

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

SocketHub maintains the set of active clients and broadcasts messages to the clients.

func NewSocketHub

func NewSocketHub() *SocketHub

NewSocketHub creates a web socket hub that distributes meter status and query results for the ui or other clients

func (*SocketHub) Run

func (h *SocketHub) Run(in <-chan SocketValue)

Run starts data and status distribution

type SocketValue

type SocketValue struct {
	Key string
	Val interface{}
}

Jump to

Keyboard shortcuts

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