websocket

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2019 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Upgrader = websocket.Upgrader{ReadBufferSize: 1024, WriteBufferSize: 1024}
)

Functions

This section is empty.

Types

type Breaker

type Breaker interface {
	Register(conn *websocket.Conn) error
	UnRegister(client *Client) error
	BroadCast(msg Message) error
}

func NewBreaker

func NewBreaker(opts ...Option) (Breaker, error)

Create Breaker

type Client

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

It is a client between a server and a client

func NewClient

func NewClient(bk *breaker, conn *websocket.Conn) (*Client, error)

type ErrorHandler

type ErrorHandler func(error)

It is executed if error is raised

type Message

type Message interface {
	GetMessage() []byte
}

It is interface on message.

type Option

type Option interface {
	// contains filtered or unexported methods
}

type OptionFunc

type OptionFunc func(bk *breaker)

func WithErrorHandlerOption

func WithErrorHandlerOption(f ErrorHandler) OptionFunc

func WithMaxMessagePoolLength

func WithMaxMessagePoolLength(length int64) OptionFunc

func WithMaxReadLimit

func WithMaxReadLimit(length int64) OptionFunc

Jump to

Keyboard shortcuts

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