ws

package
v0.1.21 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Adapter

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

func New

func New(registry Registry, opts Options) *Adapter

func (*Adapter) ServeConn

func (a *Adapter) ServeConn(ctx context.Context, conn *websocket.Conn, client *realtime.Client)

func (*Adapter) ServeHTTP

func (a *Adapter) ServeHTTP(w http.ResponseWriter, r *http.Request)

type ClientFactory

type ClientFactory func(*http.Request) *realtime.Client

type MessageHandler

type MessageHandler func(context.Context, *realtime.Client, []byte) error

type Options

type Options struct {
	ReadTimeout      time.Duration
	WriteTimeout     time.Duration
	PingInterval     time.Duration
	ClientBufferSize int
	MaxMessageSize   int64
	ReadBufferSize   int
	WriteBufferSize  int
	CheckOrigin      func(*http.Request) bool
	Logger           transport.Logger
	Lifecycle        transport.Lifecycle
	OnMessage        MessageHandler
	NewClient        ClientFactory
}

type Registry

type Registry interface {
	Add(c *realtime.Client) error
	Remove(clientID string) error
}

Jump to

Keyboard shortcuts

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