Documentation
¶
Index ¶
- func New(opts ...Option) *aria
- type Aria
- type Conn
- type Conns
- type FilterFunc
- type Option
- func WithComporessionMode(mode int) Option
- func WithCompressionThreshold(threshold int) Option
- func WithInsecureSkipVerify(skip bool) Option
- func WithOnPingReceived(fn func(ctx context.Context, payload []byte) bool) Option
- func WithOnPongReceived(fn func(ctx context.Context, payload []byte)) Option
- func WithOriginPatterns(patterns ...string) Option
- func WithSubprotocols(protocols ...string) Option
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Aria ¶
type Aria interface {
BroadCast(ctx context.Context, message []byte) error
BroadCastFilter(ctx context.Context, message []byte, filter FilterFunc) error
HandleWithContext(ctx context.Context, w http.ResponseWriter, r *http.Request) error
Handle(w http.ResponseWriter, r *http.Request) error
OnConnect(func(ctx context.Context, conn *Conn) error)
OnMessage(func(ctx context.Context, conn *Conn, message []byte) error)
OnMessageBinary(func(ctx context.Context, conn *Conn, message []byte) error)
OnDisconnect(func(ctx context.Context, conn *Conn) error)
OnClose(func(ctx context.Context, conn *Conn) error)
OnError(func(ctx context.Context, conn *Conn, err error))
}
type Conn ¶
type Conn struct {
// contains filtered or unexported fields
}
type Conns ¶
type Conns map[*Conn]struct{}
type FilterFunc ¶
type Option ¶
type Option interface {
Apply(*aria)
}
Option represents a configuration option for an aria instance. Options can be passed to New() to customize server behavior.
func WithComporessionMode ¶
WithComporessionMode sets the compression mode for WebSocket messages. Use values from websocket.CompressionMode.
func WithCompressionThreshold ¶
WithCompressionThreshold sets the minimum message size (in bytes) required before compression is applied.
func WithInsecureSkipVerify ¶
WithInsecureSkipVerify configures whether to skip TLS certificate verification during the WebSocket handshake. This is useful for development or when using self-signed certificates.
func WithOnPingReceived ¶
WithOnPingReceived registers a handler for incoming Ping frames. The callback return value determines whether the library should automatically respond with a Pong frame (true = auto respond).
func WithOnPongReceived ¶
WithOnPongReceived registers a handler for incoming Pong frames.
func WithOriginPatterns ¶
WithOriginPatterns sets the allowed origin patterns for validating the WebSocket client's Origin header.
func WithSubprotocols ¶
WithSubprotocols specifies the WebSocket subprotocols that the server is willing to accept during the handshake.