socketer

package
v0.2.10 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2024 License: MIT, MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrorInvalidClient = errors.New("invalid client")
)

Functions

This section is empty.

Types

type Client

type Client interface {
	Write(bytes []byte) error

	MustWrite(bytes []byte)
}

type Config

type Config struct {
	ReadLimit  int64
	WriteLimit int64

	ReadBufferSize  int
	WriteBufferSize int
}

type Ws

type Ws interface {
	Broadcast(bytes []byte)
	Find(id ...string) ([]Client, error)
	FindOne(id string) (Client, error)
	Upgrade(req *http.Request, res http.ResponseWriter, id string) error
	OnRead(fn func(bytes []byte)) Ws

	MustFind(id ...string) []Client
	MustFindOne(id string) Client
	MustUpgrade(req *http.Request, res http.ResponseWriter, id string)
}

func New

func New(config ...Config) Ws

Jump to

Keyboard shortcuts

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