websocket

package
v0.21.0-pre.20221120 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2022 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Multiplexor

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

Multiplexor is responsible for handling the data transfer between the storage layer and the registry. Note this is still a WIP as right now the registry is assumed to handle everything.

func NewMultiplexor

func NewMultiplexor(log logging.SimpleLogging, keyGenerator PartitionKeyGenerator, registry PartitionRegistry, checkOrigin bool) *Multiplexor

func (*Multiplexor) Handle

func (m *Multiplexor) Handle(w http.ResponseWriter, r *http.Request) error

Handle should be called for a given websocket request. It blocks while writing to the websocket until the buffer is closed.

type PartitionKeyGenerator

type PartitionKeyGenerator interface {
	Generate(r *http.Request) (string, error)
}

PartitionKeyGenerator generates partition keys for the multiplexor

type PartitionRegistry

type PartitionRegistry interface {
	Register(key string, buffer chan string)
	Deregister(key string, buffer chan string)
	IsKeyExists(key string) bool
}

PartitionRegistry is the registry holding each partition and is responsible for registering/deregistering new buffers

type Writer

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

func NewWriter

func NewWriter(log logging.SimpleLogging, checkOrigin bool) *Writer

func (*Writer) Write

func (w *Writer) Write(rw http.ResponseWriter, r *http.Request, input chan string) error

Jump to

Keyboard shortcuts

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