ws

package
v0.5.4 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2025 License: MIT Imports: 11 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Connection

type Connection struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func Dial

func Dial(ctx context.Context, url string) (*Connection, error)

func NewConnection

func NewConnection(ctx context.Context, socket *websocket.Conn) *Connection

func (*Connection) Close

func (c *Connection) Close() error

func (*Connection) EmitClosing

func (c *Connection) EmitClosing()

func (*Connection) Id

func (c *Connection) Id() string

func (*Connection) OnClosing

func (c *Connection) OnClosing(onClosing func())

func (*Connection) ReadPump

func (c *Connection) ReadPump()

func (*Connection) SetOutput

func (c *Connection) SetOutput(out io.WriteCloser)

func (*Connection) Url

func (c *Connection) Url() string

func (*Connection) Use added in v0.5.0

func (c *Connection) Use(m Middleware)

func (*Connection) Write

func (c *Connection) Write(bytes []byte) (int, error)

func (*Connection) WritePump

func (c *Connection) WritePump()

type Hub

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

Hub maintains the set of active peers and broadcasts messages to the peers.

func NewHub

func NewHub(ctx context.Context, registry *remote.Registry) *Hub

func (*Hub) Close

func (h *Hub) Close()

func (*Hub) ServeHTTP

func (h *Hub) ServeHTTP(w http.ResponseWriter, r *http.Request)

type LockWriter

type LockWriter struct {
	sync.Mutex
	// contains filtered or unexported fields
}

LockWriter is a writer that locks the underlying writer using a mutex.

func NewLockWriter

func NewLockWriter(writer io.Writer) *LockWriter

func (*LockWriter) Write

func (l *LockWriter) Write(p []byte) (n int, err error)

type LogMiddleware added in v0.5.0

type LogMiddleware struct{}

func (LogMiddleware) Process added in v0.5.0

func (l LogMiddleware) Process(msg []byte) ([]byte, error)

type Middleware added in v0.5.0

type Middleware interface {
	Process(msg []byte) ([]byte, error)
}

type MiddlewareFunc added in v0.5.0

type MiddlewareFunc func(msg []byte) ([]byte, error)

func (MiddlewareFunc) Process added in v0.5.0

func (f MiddlewareFunc) Process(msg []byte) ([]byte, error)

Jump to

Keyboard shortcuts

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