Documentation ¶
Index ¶
- type Config
- type Memory
- type Message
- type Resource
- type ResourceMessage
- type Server
- func (s *Server) AddUser(user *User)
- func (s *Server) BroadcastMessage(msg *Message)
- func (s *Server) DeleteUser(user *User)
- func (s *Server) EventsHandler(ws *websocket.Conn)
- func (s *Server) HandleMessage(msg *ThingMessage)
- func (s *Server) ListenAndServe() error
- func (s *Server) RootHandler(w http.ResponseWriter, r *http.Request)
- type Storage
- type Thing
- type ThingMessage
- type User
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Memory ¶
type Memory struct {
// contains filtered or unexported fields
}
func NewMemoryStore ¶
type Message ¶
type Message struct { Id int64 `json:"id"` Body string `json:"body"` Content interface{} `json:"content"` }
Messages that will be sent by the server and users
type ResourceMessage ¶
Event messages for create-update-delete events on resources
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Wrap HTTP methods
func (*Server) BroadcastMessage ¶
Broadcast method for users
func (*Server) DeleteUser ¶
func (*Server) EventsHandler ¶
Main websocket handler for users Receives new events
func (*Server) ListenAndServe ¶
func (*Server) RootHandler ¶
func (s *Server) RootHandler(w http.ResponseWriter, r *http.Request)
Serve the list template
type Thing ¶
type Thing struct { Id int64 `json:"id"` Name string `json:"name"` Timestamp time.Time `json:"timestamp"` }
A basic resource
type ThingMessage ¶
Event messages for create-update-delete events specific to Thing
func (ThingMessage) String ¶
func (t ThingMessage) String() string
Click to show internal directories.
Click to hide internal directories.