server

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Jan 4, 2019 License: MIT Imports: 43 Imported by: 0

Documentation

Index

Constants

View Source
const (
	UnknownPage pageType = iota
	PlayPage
	JsgoPage
	FrizzPage
)

Variables

This section is empty.

Functions

func ServeStatic

func ServeStatic(name string, w http.ResponseWriter, req *http.Request, mimeType string) error

func StreamWithTimeout

func StreamWithTimeout(w io.Writer, r io.Reader) error

func WriteWithTimeout

func WriteWithTimeout(w io.Writer, b []byte) error

Types

type Handler

type Handler struct {
	Cache      *cache.Cache
	Fileserver services.Fileserver
	Database   services.Database
	Waitgroup  *sync.WaitGroup
	Queue      *queue.Queue
	// contains filtered or unexported fields
}

func New

func New(shutdown chan struct{}) *Handler

func (*Handler) CssHandler

func (h *Handler) CssHandler(w http.ResponseWriter, req *http.Request)

func (*Handler) HealthCheckHandler

func (h *Handler) HealthCheckHandler(w http.ResponseWriter, r *http.Request)

func (*Handler) IconHandler

func (h *Handler) IconHandler(w http.ResponseWriter, req *http.Request)

func (*Handler) PageHandler

func (h *Handler) PageHandler(w http.ResponseWriter, req *http.Request)

func (*Handler) ScriptHandler

func (h *Handler) ScriptHandler(w http.ResponseWriter, req *http.Request)

func (*Handler) ServeHTTP

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

func (*Handler) SocketHandler

func (h *Handler) SocketHandler(s SocketHandlerInterface) func(w http.ResponseWriter, req *http.Request)

type Pather

type Pather interface {
	Path() string
}

type SocketHandlerInterface

type SocketHandlerInterface interface {
	Handle(ctx context.Context, req *http.Request, send func(message services.Message), receive chan services.Message, tj *tracker.Job) error
	RequestTimeout() time.Duration
	WebsocketPingPeriod() time.Duration
	WebsocketTimeout() time.Duration
	WebsocketPongTimeout() time.Duration
	MarshalMessage(services.Message) (payload []byte, messageType int, err error)
	UnarshalMessage([]byte) (services.Message, error)
	StoreError(ctx context.Context, err error, req *http.Request)
}

Jump to

Keyboard shortcuts

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