fastws

package module
v0.0.0-...-10db8cc Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2026 License: Apache-2.0 Imports: 7 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewClient

func NewClient(ctx *gonet.AppContext[*Session], options ...Option) gonet.IClient

func NewServer

func NewServer(ctx *gonet.AppContext[*Session], options ...Option) gonet.IServer

Types

type Option

type Option func(*option)

func WithCheckOrigin

func WithCheckOrigin(fn func(ctx *fasthttp.RequestCtx) bool) Option

func WithEnableCompression

func WithEnableCompression(enable bool) Option

func WithHandshakeTimeout

func WithHandshakeTimeout(t time.Duration) Option

func WithReadBufferSize

func WithReadBufferSize(size int) Option

func WithWriteBufferSize

func WithWriteBufferSize(size int) Option

type Session

type Session struct {
	gonet.SessionCommon
	// contains filtered or unexported fields
}

Session is the fasthttp WebSocket connection session.

func (*Session) Clear

func (s *Session) Clear()

Clear resets the session so it can be reused from the pool.

func (*Session) Close

func (s *Session) Close() error

func (*Session) ReadLoop

func (s *Session) ReadLoop()

ReadLoop reads WebSocket frames until the connection closes.

func (*Session) RemoteAddr

func (s *Session) RemoteAddr() net.Addr

func (*Session) Send

func (s *Session) Send(msgID uint32, msg any) error

Send is safe to call from multiple goroutines (WebSocket requires serialized writes).

Jump to

Keyboard shortcuts

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