hub

package
v0.0.0-...-78bde51 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrRoomNotFound = errors.New("room not found")
)

Functions

This section is empty.

Types

type Hub

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

func New

func New(lc fx.Lifecycle, logger *slog.Logger, tmpl *template.Template) *Hub

func (*Hub) Join

func (h *Hub) Join(id int64, o notifier.Observer[*Message]) *list.Element

func (*Hub) Leave

func (h *Hub) Leave(id int64, e *list.Element) error

func (*Hub) Send

func (h *Hub) Send(id int64, msg *Message) error

type Message

type Message struct {
	Sender  string `json:"-"`
	Payload string `json:"payload"`
}

Jump to

Keyboard shortcuts

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