socketer

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 29, 2024 License: MIT Imports: 7 Imported by: 1

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 ...int) ([]Client, error)
	FindOne(id int) (Client, error)
	Serve(req *http.Request, res http.ResponseWriter, id int) error
	OnRead(fn func(bytes []byte)) Ws

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

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