gowebsockethub

package module
v0.0.0-...-cb05811 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Handle

func Handle(route Route, handler Handler)

func Intercept

func Intercept(route Route, interceptor Handler)

func SetMessageParser

func SetMessageParser(p MessageParser)

Types

type Handler

type Handler func(ctx context.Context, message Message, writing chan<- Message) error

type Hub

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

func New

func New(conn *websocket.Conn, readingCapacity uint32, writingCapacity uint32) (hub *Hub, writing chan Message, errs chan error)

func (*Hub) Handle

func (hub *Hub) Handle(route Route, handler Handler)

func (*Hub) Intercept

func (hub *Hub) Intercept(route Route, interceptor Handler)

func (*Hub) Run

func (hub *Hub) Run(ctx context.Context)

func (*Hub) SetMaxMessageSize

func (hub *Hub) SetMaxMessageSize(size int64)

func (*Hub) SetMessageParser

func (hub *Hub) SetMessageParser(p MessageParser)

func (*Hub) SetPingPeriod

func (hub *Hub) SetPingPeriod(period time.Duration)

func (*Hub) SetReadWait

func (hub *Hub) SetReadWait(wait time.Duration)

func (*Hub) SetWriteWait

func (hub *Hub) SetWriteWait(wait time.Duration)

type Message

type Message interface {
	GetID() string
	GetRoute() Route
	GetPayload() string
}

type MessageParser

type MessageParser func(ctx context.Context, raw []byte) (Message, error)

type Route

type Route string

Jump to

Keyboard shortcuts

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