websocket

package
v0.0.0-rc8 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrPoolIsFull     = fmt.Errorf("pool is full")
	ErrClientNotFound = fmt.Errorf("client not found")
)

Functions

This section is empty.

Types

type BroadcastMessage

type BroadcastMessage struct {
	Payload []byte `json:"payload"`
}

func NewBroadcastMessage

func NewBroadcastMessage(payload []byte) BroadcastMessage

type ClientMessage

type ClientMessage struct {
	ClientId string `json:"clientId"`
	Payload  []byte `json:"payload"`
}

func NewClientMessage

func NewClientMessage(clientId string, payload []byte) ClientMessage

type Handler

type Handler func(msg ClientMessage)

type Pool

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

func NewPool

func NewPool(size int) *Pool

func (*Pool) Broadcast

func (p *Pool) Broadcast(msg []byte)

func (*Pool) Close

func (p *Pool) Close() error

func (*Pool) Count

func (p *Pool) Count() int

func (*Pool) Register

func (p *Pool) Register(id string, r *http.Request, w http.ResponseWriter) error

func (*Pool) RegisterHandler

func (p *Pool) RegisterHandler(h Handler)

func (*Pool) Send

func (p *Pool) Send(clientId string, msg []byte)

func (*Pool) Unregister

func (p *Pool) Unregister(id string) error

Jump to

Keyboard shortcuts

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