server

package
v1.0.1-rc1 Latest Latest
Warning

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

Go to latest
Published: May 29, 2019 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	NilConnErr             = errors.New("nil websocket connection")
	NilDispatcherErr       = errors.New("nil dispatcher, need invoke server.Init(dispatcher)")
	TimeoutErr             = errors.New("time out")
	WriteInClosedWriterErr = errors.New("writer has been already closed")
)

Functions

func Init

func Init(cnf *config.WebsocketConfig, dispatcher core.Dispatcher, ticker *tw.TimingWheel)

func ListenAndServe

func ListenAndServe(stop <-chan bool) error

func NewSession

func NewSession(conn *ws.Conn, opt *Opt) (io.WriteCloser, error)

func Serve404

func Serve404(wrt http.ResponseWriter, req *http.Request)

Custom 404 response.

func TlsRedirect

func TlsRedirect(toPort string) http.HandlerFunc

Redirect HTTP requests to HTTPS

Types

type Opt

type Opt struct {
	Tls                *config.WsTlsConfig
	Dispatcher         core.Dispatcher
	Ticker             *tw.TimingWheel
	IdleSessionTimeout time.Duration
	WriteWait          time.Duration
	SessionQueueSize   int
	QueueOutTimeout    time.Duration
	ReadBufferSize     int
	WriteBufferSize    int
	IDSalt             string
	CheckOrigin        func(*http.Request) bool
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

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