Documentation ¶
Index ¶
- func ChargeModeHandler(lp api.LoadPoint) http.HandlerFunc
- func CurrentChargeModeHandler(lp api.LoadPoint) http.HandlerFunc
- func Dir(useLocal bool, name string) http.FileSystem
- func FS(useLocal bool) http.FileSystem
- func FSByte(useLocal bool, name string) ([]byte, error)
- func FSMustByte(useLocal bool, name string) []byte
- func FSMustString(useLocal bool, name string) string
- func FSString(useLocal bool, name string) (string, error)
- func IndexHandler(liveAssets bool) http.HandlerFunc
- func JsonHandler(h http.Handler) http.Handler
- func NewHttpd(url string, lp *core.LoadPoint, hub *SocketHub) *http.Server
- func RouteLogger(inner http.Handler) http.HandlerFunc
- func ServeWebsocket(hub *SocketHub, w http.ResponseWriter, r *http.Request)
- func SocketHandler(hub *SocketHub) http.HandlerFunc
- type DebugLogger
- type SocketClient
- type SocketHub
- type SocketValue
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 ¶
FSByte returns the named file from the embedded assets. If useLocal is true, the filesystem's contents are instead used.
func FSMustByte ¶
FSMustByte is the same as FSByte, but panics if name is not present.
func FSMustString ¶
FSMustString is the string version of FSMustByte.
func IndexHandler ¶
func IndexHandler(liveAssets bool) http.HandlerFunc
func JsonHandler ¶
JsonHandler is a middleware that decorates responses with JSON and CORS headers
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
}
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{} }