server

package
v1.4.3 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2023 License: MPL-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ReadTimeout  string = "read timeout is less than 0"
	WriteTimeout string = "write timeout is less than 0"
	PingTimeout  string = "ping timeout is less than 0"
	PingInterval string = "ping interval is less than 0"
)
View Source
const (
	EnvNameReadTimeout  string = "BLUDGEON_WEBSOCKET_READ_TIMEOUT"
	EnvNameWriteTimeout string = "BLUDGEON_WEBSOCKET_WRITE_TIMEOUT"
	EnvNamePingTimeout  string = "BLUDGEON_WEBSOCKET_PING_TIMEOUT"
	EnvNamePingInterval string = "BLUDGEON_WEBSOCKET_PING_INTERVAL"
)
View Source
const (
	DefaultReadTimeout  time.Duration = 10 * time.Second
	DefaultWriteTimeout time.Duration = 10 * time.Second
	DefaultPingTimeout  time.Duration = 20 * time.Second
	DefaultPingInterval time.Duration = 5 * time.Second
)
View Source
const (
	NotConnected string = "not connected"
)

Variables

View Source
var (
	ErrReadTimeout  = errors.New(ReadTimeout)
	ErrWriteTimeout = errors.New(WriteTimeout)
	ErrPingTimeout  = errors.New(PingTimeout)
	ErrPingInterval = errors.New(PingInterval)
)
View Source
var ErrNotConnected = errors.New(NotConnected)

Functions

func New

func New(parameters ...interface{}) interface {
	Server
	internal.Configurer
	internal.Closer
}

Types

type Configuration

type Configuration struct {
	WriteTimeout time.Duration `json:"write_timeout"`
	ReadTimeout  time.Duration `json:"read_timeout"`
	PingInterval time.Duration `json:"ping_interval"`
	PingTimeout  time.Duration `json:"ping_timeout"`
}

func (*Configuration) Default

func (c *Configuration) Default()

func (*Configuration) FromEnv

func (c *Configuration) FromEnv(envs map[string]string)

func (*Configuration) Validate

func (c *Configuration) Validate() error

type Server

type Server interface {
	Write(item interface{}) error
	Read(item interface{}) error
}

Jump to

Keyboard shortcuts

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