websockets

package module
v2.16.1 Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2022 License: MIT Imports: 26 Imported by: 1

README

websockets

RRv2 websockets HTTP middleware

Documentation

Index

Constants

View Source
const (
	PluginName string = "websockets"

	RrMode          string = "RR_MODE"
	RrBroadcastPath string = "RR_BROADCAST_PATH"
	OriginHeaderKey string = "Origin"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// http path for the websocket
	Path          string `mapstructure:"path"`
	AllowedOrigin string `mapstructure:"allowed_origin"`
	Broker        string `mapstructure:"broker"`

	// Pool with the workers for the websockets
	Pool *pool.Config `mapstructure:"pool"`
	// contains filtered or unexported fields
}

Config represents configuration for the ws plugin

func (*Config) InitDefault

func (c *Config) InitDefault() error

InitDefault initialize default values for the ws config

type Plugin

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

func (*Plugin) Init

func (p *Plugin) Init(cfg config.Configurer, log *zap.Logger, server server.Server, b pubsub.Broadcaster) error

func (*Plugin) Middleware

func (p *Plugin) Middleware(next http.Handler) http.Handler

func (*Plugin) Name

func (p *Plugin) Name() string

func (*Plugin) Reset

func (p *Plugin) Reset() error

Reset destroys the old pool and replaces it with new one, waiting for old pool to die

func (*Plugin) Serve

func (p *Plugin) Serve() chan error

func (*Plugin) Stop

func (p *Plugin) Stop() error

func (*Plugin) Workers

func (p *Plugin) Workers() []*process.State

Workers returns slice with the process states for the workers

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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