Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AssetsHandler ¶
type AssetsHandler struct{}
AssetsHandler handles HTTP requests for static files.
func (*AssetsHandler) ServeHTTP ¶
func (h *AssetsHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP sends the requested asset file.
type DB ¶
DB represents a simple in-memory database. It stores data in FIFO order so that data can be retrieved by index.
func (*DB) Unsubscribe ¶
Unsubscribe removes a channel as a subscriber.
type IndexHandler ¶
type IndexHandler struct{}
IndexHandler returns the main index page.
func (*IndexHandler) ServeHTTP ¶
func (h *IndexHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP sends the index page to the client.
type Row ¶
type Row struct { Data map[string]interface{} // contains filtered or unexported fields }
Row represents a single element in the database.
func (*Row) MarshalJSON ¶
MarshalJSON encodes a row into a JSON structure.
type SubscribeHandler ¶
type SubscribeHandler struct {
// contains filtered or unexported fields
}
SubscribeHandler sends data to the client via server sent events.
func NewSubscribeHandler ¶
func NewSubscribeHandler(db *DB) *SubscribeHandler
NewSubscribeHandler returns a new subscription handler for a database.
func (*SubscribeHandler) ServeHTTP ¶
func (h *SubscribeHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP sends the database data.
Click to show internal directories.
Click to hide internal directories.