server

package
v0.6.1-0...-efaa8b1 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2017 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

	// EnableLongPolling controls if long polling is used. If false than clients
	// will be given an immediate empty repsonse if no messages are waiting for
	// them. If true the connection will be held until a message comes in or until
	// it timesout.
	EnableLongPolling = true

	// ThrottleDelay will delay messages from being pushed to clients. This will
	// artificially throttle the connect and reconnects from the clients.
	ThrottleDelay = 500 * time.Millisecond
)

Functions

func Start

func Start(addr string) error

Start loads the web server and begins listening.

Types

type EndPoint

type EndPoint struct {
	Method  string
	Regex   *regexp.Regexp
	Handler http.Handler
}

EndPoint repesents an API endpoint for the server and is used in request routing.

type EndPointHandler

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

EndPointHandler is a collection of API endpoints.

func (*EndPointHandler) Add

func (h *EndPointHandler) Add(method string, pattern string,
	handler func(http.ResponseWriter, *http.Request))

Add will add an endpoint to the handler.

func (*EndPointHandler) ServeHTTP

func (h *EndPointHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP matches the request to the appropriate route and calls its handler.

Jump to

Keyboard shortcuts

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