server

package
v1.8.0 Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2018 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// CloseStatus is status code set when closing client connections.
	CloseStatus = 3000
)

Variables

This section is empty.

Functions

func ServeMux added in v1.7.4

func ServeMux(s *HTTPServer, muxOpts MuxOptions) *http.ServeMux

ServeMux returns a mux including set of default handlers for Centrifugo server.

Types

type Config added in v1.7.4

type Config struct {
	// WebsocketCompression allows to enable websocket permessage-deflate
	// compression support for raw websocket connections. It does not guarantee
	// that compression will be used - i.e. it only says that Centrifugo will
	// try to negotiate it with client.
	WebsocketCompression bool `json:"websocket_compression"`

	// WebsocketCompressionLevel sets a level for websocket compression.
	// See posiible value description at https://golang.org/pkg/compress/flate/#NewWriter
	WebsocketCompressionLevel int `json:"websocket_compression_level"`

	// WebsocketCompressionMinSize allows to set minimal limit in bytes for message to use
	// compression when writing it into client connection. By default it's 0 - i.e. all messages
	// will be compressed when WebsocketCompression enabled and compression negotiated with client.
	WebsocketCompressionMinSize int `json:"websocket_compression_min_size"`

	// WebsocketReadBufferSize is a parameter that is used for raw websocket Upgrader.
	// If set to zero reasonable default value will be used.
	WebsocketReadBufferSize int `json:"websocket_read_buffer_size"`

	// WebsocketWriteBufferSize is a parameter that is used for raw websocket Upgrader.
	// If set to zero reasonable default value will be used.
	WebsocketWriteBufferSize int `json:"websocket_write_buffer_size"`
}

Config contains HTTPServer configuration options.

type HTTPServer added in v1.7.4

type HTTPServer struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

HTTPServer is a default builtin Centrifugo server.

func New added in v1.7.4

func New(n *node.Node, config *Config) (*HTTPServer, error)

New initializes HTTPServer.

func (*HTTPServer) ServeHTTP added in v1.7.4

func (s *HTTPServer) ServeHTTP(rw http.ResponseWriter, r *http.Request)

func (*HTTPServer) Shutdown added in v1.7.4

func (s *HTTPServer) Shutdown() error

Shutdown shuts down server.

type HandlerFlag added in v1.7.4

type HandlerFlag int

HandlerFlag is a bit mask of handlers that must be enabled in mux.

const (
	// HandlerRawWS enables Raw Websocket handler.
	HandlerRawWS HandlerFlag = 1 << iota
	// HandlerSockJS enables SockJS handler.
	HandlerSockJS
	// HandlerAPI enables API handler.
	HandlerAPI
	// HandlerAdmin enables admin Websocket handler.
	HandlerAdmin
	// HandlerDebug enables debug handlers.
	HandlerDebug
	// HandlerWeb enables web interface serving.
	HandlerWeb
)

func (HandlerFlag) String added in v1.7.4

func (flags HandlerFlag) String() string

type MuxOptions added in v1.7.4

type MuxOptions struct {
	Prefix        string
	WebPath       string
	WebFS         http.FileSystem
	SockjsOptions sockjs.Options
	HandlerFlags  HandlerFlag
}

MuxOptions contain various options for DefaultMux.

Jump to

Keyboard shortcuts

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