api

package
v1.0.5 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2020 License: GPL-3.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(app types.App) http.Handler

New creates a new API handler

Types

type API

type API struct {
	types.App
	*Hub
	*mux.Router
}

API exposes endpoints for the webapp to perform HTTP RESTFull actions

func (*API) ServeHTTP

func (a *API) ServeHTTP(w http.ResponseWriter, r *http.Request)

type Client added in v1.0.0

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

Client is a middleman between the websocket connection and the hub.

type Error

type Error interface {
	error
	Status() int
}

Error is an error occurring in an API endpoint

func NewError added in v1.0.0

func NewError(err error, status int) Error

NewError returns a new error

type Hub added in v1.0.0

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

Hub maintains the set of active clients and broadcasts messages to the clients.

func (*Hub) Broadcast added in v1.0.0

func (h *Hub) Broadcast(msg []byte)

Broadcast sends a message to all connected clients

func (*Hub) Register added in v1.0.0

func (h *Hub) Register(ws *websocket.Conn)

Register registers a new client in the hub

Jump to

Keyboard shortcuts

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