web

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CommandMessage

type CommandMessage struct {
	Command string `json:"command"`
}

CommandMessage is a message object for commands, containing a command.

type ErrorResponse

type ErrorResponse struct {
	SimpleResponse
	Message string `json:"message"`
}

ErrorResponse is a response object for errors, containing a result (nok) and a message.

type SimpleResponse

type SimpleResponse struct {
	Result string `json:"result"`
}

SimpleResponse is a simple response object, containing a result (ok, nok).

type StateResponse

type StateResponse struct {
	SimpleResponse
	State string `json:"state"`
}

StateResponse is a response object for the state of the door, containing a result (ok) and the state.

type WebService added in v0.0.2

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

WebService is a singleton that encapsulates the web server, and retains a cache of valid API keys.

func GetWebService

func GetWebService() *WebService

GetWebService returns the one and only WebServiceImpl instance.

func (*WebService) Start added in v0.0.2

func (s *WebService) Start()

Start the web server.

func (*WebService) Stop added in v0.0.2

func (s *WebService) Stop()

Stop the web server.

type WebSocketStateListener

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

WebSocketStateListener implements the handler to report state changes to a websocket, and register and unregister the listener with the DoorControllerService.

func (*WebSocketStateListener) Connect

func (w *WebSocketStateListener) Connect(ws *websocket.Conn)

Connect registers the websocket, and adds a state listener to send state updates to the websocket.

func (*WebSocketStateListener) Disconnect

func (w *WebSocketStateListener) Disconnect()

Disconnect removes the state listener.

func (*WebSocketStateListener) StateChanged

func (w *WebSocketStateListener) StateChanged(state string)

StateChanged handles sending state updates to the websocket.

Jump to

Keyboard shortcuts

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