websocket

package
v1.2.2 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2022 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BufferPoolKey

type BufferPoolKey struct{}

type CheckOriginKey

type CheckOriginKey struct{}

type ErrorKey

type ErrorKey struct{}

type Option

type Option func(*Options)

func WithCheckOrigin

func WithCheckOrigin(checkOrigin func(r *http.Request) bool) Option

func WithEnableCompression

func WithEnableCompression(enableCompression bool) Option

func WithError

func WithError(err func(w http.ResponseWriter, r *http.Request, status int, reason error)) Option

func WithHandshakeTimeout

func WithHandshakeTimeout(handshakeTimeout time.Duration) Option

func WithReadBufferSize

func WithReadBufferSize(readBuffSize int) Option

func WithSubprotocols

func WithSubprotocols(subProtocols []string) Option

func WithWriteBufferPool

func WithWriteBufferPool(writeBufferPool websocket.BufferPool) Option

func WithWriteBufferSize

func WithWriteBufferSize(writeBuffSize int) Option

type Options

type Options struct {
	HandshakeTimeout time.Duration

	ReadBufferSize, WriteBufferSize int

	WriteBufferPool websocket.BufferPool

	Subprotocols []string

	Error func(w http.ResponseWriter, r *http.Request, status int, reason error)

	CheckOrigin func(r *http.Request) bool

	EnableCompression bool
}

type Websocket

type Websocket struct {
	websocket.Upgrader
	// contains filtered or unexported fields
}

func New

func New(opts ...Option) *Websocket

func (*Websocket) Provide

func (ws *Websocket) Provide(ctx context.Context) interface{}

Jump to

Keyboard shortcuts

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