wsserver

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2025 License: BSD-3-Clause Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Connection

type Connection interface {
	ID() string
}

type Handler

type Handler interface {
	ID() string
	Call(args ...any) error
}

type WsCloseHandler

type WsCloseHandler struct {
	WsHandler
	// contains filtered or unexported fields
}

func NewWsCloseHandler

func NewWsCloseHandler(handlerFunction func(connection *WsConnection) error) *WsCloseHandler

func (*WsCloseHandler) Call

func (h *WsCloseHandler) Call(args ...any) error

type WsConnection

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

func NewWsConnection

func NewWsConnection(conn *websocket.Conn) *WsConnection

func (*WsConnection) Close

func (c *WsConnection) Close() error

func (*WsConnection) Conn

func (c *WsConnection) Conn() *websocket.Conn

func (*WsConnection) ID

func (c *WsConnection) ID() string

type WsConnectionHandler

type WsConnectionHandler struct {
	WsHandler
	// contains filtered or unexported fields
}

func NewWsConnectionHandler

func NewWsConnectionHandler(handlerFunction func(connection *WsConnection) error) *WsConnectionHandler

func (*WsConnectionHandler) Call

func (h *WsConnectionHandler) Call(args ...any) error

type WsHandler

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

func (*WsHandler) ID

func (h *WsHandler) ID() string

type WsManager

type WsManager struct {
	Connections          connectionList[*WsConnection]
	OnMessageHandlers    handlerList[*WsMessageHandler]
	OnCloseHandlers      handlerList[*WsCloseHandler]
	OnConnectionHandlers handlerList[*WsConnectionHandler]
	// contains filtered or unexported fields
}

func NewWsManager

func NewWsManager() *WsManager

func (*WsManager) WebsocketEndpointHandler

func (s *WsManager) WebsocketEndpointHandler(w http.ResponseWriter, r *http.Request)

type WsMessageHandler

type WsMessageHandler struct {
	WsHandler
	// contains filtered or unexported fields
}

func NewWsMessageHandler

func NewWsMessageHandler(handlerFunction func(connection *WsConnection, message []byte) error) *WsMessageHandler

func (*WsMessageHandler) Call

func (h *WsMessageHandler) Call(args ...any) error

Jump to

Keyboard shortcuts

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