Documentation
¶
Index ¶
- type Client
- type ClientJSON
- type Config
- type Manager
- type Service
- func (s *Service) CreateHandler(w http.ResponseWriter, r *http.Request)
- func (s *Service) DeleteAllHandler(w http.ResponseWriter, r *http.Request)
- func (s *Service) DeleteHandler(w http.ResponseWriter, r *http.Request)
- func (s *Service) GetAllHandler(w http.ResponseWriter, r *http.Request)
- func (s *Service) GetHandler(w http.ResponseWriter, r *http.Request)
- func (s *Service) GetManager() *Manager
- func (s *Service) SendByID(clientID string, msg string)
- func (s *Service) SendByMedia(mediaID int, msg string)
- func (s *Service) UpdateHandler(w http.ResponseWriter, r *http.Request)
- func (s *Service) WSConnectionHandler(w http.ResponseWriter, r *http.Request)
- func (s *Service) WaitForClose(clientID string) <-chan bool
- type WSClient
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct { ID string `json:"id"` Name string `json:"name"` Type string `json:"type"` MediaID int `json:"mediaID"` }
Client represent the mapping between a ID and a readable name given by user
type ClientJSON ¶
ClientJSON respresent the client that will be sent to back-office
type Manager ¶
type Manager struct { Config *Config // contains filtered or unexported fields }
Manager manage clients config.
func (*Manager) GetAll ¶
GetAll returns the complete map of registered clients (the client ID is the key)
func (*Manager) GetConfig ¶
func (m *Manager) GetConfig() interface{}
GetConfig return a non-typed pointer to the configuration of the manager This is use by commons.LoadFromDB for Decoding configuration from JSON.
func (*Manager) GetSaveFilePath ¶
GetSaveFilePath return the path of the save file for the configuration Returns (fullPath, configPath, configFileName)
func (*Manager) LoadFromDB ¶
func (m *Manager) LoadFromDB()
LoadFromDB loads medias configuration from DB and stor it in memory
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service is the websocket connection handler
func (*Service) CreateHandler ¶
func (s *Service) CreateHandler(w http.ResponseWriter, r *http.Request)
CreateHandler create a new client entry in the database.
func (*Service) DeleteAllHandler ¶
func (s *Service) DeleteAllHandler(w http.ResponseWriter, r *http.Request)
func (*Service) DeleteHandler ¶
func (s *Service) DeleteHandler(w http.ResponseWriter, r *http.Request)
DeleteHandler delete a client from the database
func (*Service) GetAllHandler ¶
func (s *Service) GetAllHandler(w http.ResponseWriter, r *http.Request)
GetAllHandler send the list of all registered clients.
func (*Service) GetHandler ¶
func (s *Service) GetHandler(w http.ResponseWriter, r *http.Request)
GetHandler send the requested client configuration.
func (*Service) GetManager ¶
GetManager returns the client manager of the service
func (*Service) SendByMedia ¶
SendByMedia sends a message to each client connected to the given media
func (*Service) UpdateHandler ¶
func (s *Service) UpdateHandler(w http.ResponseWriter, r *http.Request)
UpdateHandler update a client configuration in the database
func (*Service) WSConnectionHandler ¶
func (s *Service) WSConnectionHandler(w http.ResponseWriter, r *http.Request)
WSConnectionHandler Handles a connection request from a given client.
func (*Service) WaitForClose ¶
type WSClient ¶
type WSClient struct {
// contains filtered or unexported fields
}
WSClient represent a websocket connection to a client.
func (*WSClient) Unregister ¶
func (ws *WSClient) Unregister()
Unregister wsclient from its service (the call the Close will be made by the service)