websocket

package
v0.0.0-...-e676b46 Latest Latest
Warning

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

Go to latest
Published: May 8, 2023 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckOrigin

func CheckOrigin(origins ...string) func(http.Handler) http.Handler

Types

type Broker

type Broker[K, V any] interface {
	Load(key K) (value V, ok bool)
	LoadOrStore(key K, value V) (actual V, loaded bool)
	Store(key K, value V)
	Delete(key K)
	LoadAndDelete(key K) (value V, loaded bool)
}

type Client

type Client struct {

	// Capacity of the send channel.
	// If capacity is 0, the send channel is unbuffered.
	Capacity uint
	// contains filtered or unexported fields
}

func NewClient

func NewClient(cap uint) *Client

NewClient instantiates a new websocket client.

NOTE: these may be useful to set: Capacity, ReadBufferSize, ReadTimeout, WriteTimeout

func (*Client) Close

func (cli *Client) Close() error

TODO -- should be able to close all connections via their own channels

func (*Client) Len

func (cli *Client) Len() int

Len returns the number of connections.

func (*Client) ServeHTTP

func (cli *Client) ServeHTTP(w http.ResponseWriter, r *http.Request)

Jump to

Keyboard shortcuts

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