ws

package
v0.0.0-...-2b6d021 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2023 License: MPL-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PoolContextKey contextKey = "pool"
)

Variables

View Source
var (
	Pool = NewConnectionPool()
)

Functions

func InjectConnectionPool

func InjectConnectionPool(next http.Handler) http.Handler

Types

type ConnectionPool

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

func NewConnectionPool

func NewConnectionPool() *ConnectionPool

func (*ConnectionPool) Add

func (p *ConnectionPool) Add(c *websocket.Conn) bool

func (*ConnectionPool) Publish

func (p *ConnectionPool) Publish(msg []byte)

Publish sends a message to all connections in the pool

eg:

ws.Pool.Publish([]byte("wu tang killa-beez, we on a swarm"))

func (*ConnectionPool) Remove

func (p *ConnectionPool) Remove(c *websocket.Conn) bool

Directories

Path Synopsis
handlers

Jump to

Keyboard shortcuts

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