client

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 = "read timeout is less than 0"
)
View Source
const (
	EnvNameReadTimeout  string = "BLUDGEON_WEBSOCKET_READ_TIMEOUT"
	EnvNameWriteTimeout string = "BLUDGEON_WEBSOCKET_WRITE_TIMEOUT"
)
View Source
const (
	DefaultReadTimeout  time.Duration = 10 * time.Second
	DefaultWriteTimeout time.Duration = 10 * time.Second
)
View Source
const (
	NotConnected string = "not connected"
)

Variables

View Source
var (
	ErrReadTimeout  = errors.New(ReadTimeout)
	ErrWriteTimeout = errors.New(WriteTimeout)
)
View Source
var ErrNotConnected = errors.New(NotConnected)

Functions

Types

type Client

type Client interface {
	Connect(ctx context.Context, url string, requestHeader http.Header) (*http.Response, error)
	IsConnected() bool
	Write(item interface{}) error
	Read(item interface{}) error
}

type Configuration

type Configuration struct {
	WriteTimeout time.Duration `json:"write_timeout"`
	ReadTimeout  time.Duration `json:"read_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() (err error)

Jump to

Keyboard shortcuts

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