proxy

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2022 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WSHTTPHandler

func WSHTTPHandler(w http.ResponseWriter, r *http.Request, wsl *WSListener, logger log.Logger)

wsHandler handles an inbound HTTP WS connection.

func WSHandle

func WSHandle(c *websocket.Conn, wsl *WSListener, logger log.Logger) error

wsHandler handles an inbound WS connection.

Types

type UpdateListener

type UpdateListener interface {
	// What just changed and the new full state.
	Update(update, full map[string]interface{})

	// This update source is done, any future updates won't be reported.
	UpdatesDone()
}

type WSDialer

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

func NewWSDialer

func NewWSDialer() (*WSDialer, error)

func (*WSDialer) Dial

func (d *WSDialer) Dial(context context.Context, url string) (*websocket.Conn, *http.Response, error)

type WSListener

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

A WSListener represents a connection to a Scoreboard, which listens to WS updates and forwards them on.

func NewWSListener

func NewWSListener(ctx context.Context, logger log.Logger, kf *keyfilter.KeyFilter, stateFile string) *WSListener

func (*WSListener) AddListener

func (wsl *WSListener) AddListener(l UpdateListener)

AddListener adds a listener.

The initial update will be in the same thread.

func (*WSListener) Receive

func (wsl *WSListener) Receive(w http.ResponseWriter, r *http.Request)

Receive uses an inbound WS connection. This is an alternative to Run.

func (*WSListener) RemoveListener

func (wsl *WSListener) RemoveListener(l UpdateListener)

RemoveListener removes a listener.

func (*WSListener) Run

func (wsl *WSListener) Run(url string, dialer *WSDialer)

Run keeps a WS connection open to the given URL.

func (*WSListener) Shutdown added in v0.0.2

func (wsl *WSListener) Shutdown()

Shutdown the listener.

func (*WSListener) Status

func (wsl *WSListener) Status() (time.Time, int, wsstate.State)

Jump to

Keyboard shortcuts

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