wss

package
v0.2.12 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2024 License: Apache-2.0 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
	Node() string
	AuthIdentity() string
	Start(ctx context.Context, readMsgHandler func(msgType int, bytes []byte)) error
	Write(msg []byte) error
	Close() error
}

Connection for Websocket Server 2.0

func New

func New(args ConstructorArgs, conn *websocket.Conn, opts ...Option) Connection

New will return a new Websocket connection that would bridge to a message queue. For now, underlying connection is stemmed from gorilla.websocket

type ConstructorArgs

type ConstructorArgs struct {
	ID           string
	Node         string
	AuthIdentity string
}

ConstructorArgs for WebsocketConnection

type Factory

type Factory interface {
	// NewConnection for WS Server 2.0.
	NewConnection(args ConstructorArgs, conn *websocket.Conn, opts ...Option) Connection
}

Factory for Connection.

func NewFactory

func NewFactory(opts ...Option) Factory

NewFactory for WSConnection. Saves and passes appropriate option.

type Option

type Option func(*configuration)

Option is the function signature that applies configurable option for UILoadWebsocket.

func MaxInactiveDuration

func MaxInactiveDuration(d time.Duration) Option

MaxInactiveDuration means the max time a connection can be 'quiet' before server will deem it as inactive and dead. Idea is that pongs and client-based pings would suffice. Default 1m.

func PingInterval

func PingInterval(d time.Duration) Option

PingInterval sets frequency to write ping messages. Default 30s.

func ReadDeadline

func ReadDeadline(d time.Duration) Option

ReadDeadline for how long it should wait until reading a message. Default infinite.

func WriteDeadline

func WriteDeadline(d time.Duration) Option

WriteDeadline for how long it should try before giving up writing a message. Default 3s.

Jump to

Keyboard shortcuts

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