bosssocket

package
v0.5.841 Latest Latest
Warning

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

Go to latest
Published: May 26, 2026 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WebSocketHandler

func WebSocketHandler(handler HandlerFunc) fasthttp.RequestHandler

WebSocketHandler возвращает fasthttp.RequestHandler с пулом буферов.

Types

type Conn added in v0.5.83

type Conn struct {
	net.Conn
	// contains filtered or unexported fields
}

Conn – обёртка над WebSocket-соединением.

func (*Conn) Close added in v0.5.83

func (c *Conn) Close() error

Close отправляет close frame и закрывает соединение.

func (*Conn) ReadText added in v0.5.83

func (c *Conn) ReadText() (string, error)

ReadText читает следующее текстовое сообщение. Использует ReadClientData, которая возвращает 3 значения.

func (*Conn) WriteText added in v0.5.83

func (c *Conn) WriteText(msg string) error

WriteText отправляет текстовое сообщение. Использует WriteServerText для отправки сообщений от сервера.

type FixedBufferPool added in v0.5.0

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

FixedBufferPool — кастомный пул буферов с ограничением максимального размера.

func NewFixedBufferPool added in v0.5.0

func NewFixedBufferPool(bufSize, maxSize int) *FixedBufferPool

func (*FixedBufferPool) Get added in v0.5.0

func (p *FixedBufferPool) Get() []byte

func (*FixedBufferPool) Put added in v0.5.0

func (p *FixedBufferPool) Put(buf []byte)

type HandlerFunc added in v0.5.83

type HandlerFunc func(ctx context.Context, conn *Conn)

HandlerFunc – пользовательская функция для обработки WebSocket.

Jump to

Keyboard shortcuts

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