kecpsignal

package
v0.0.0-...-a9c713e Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2023 License: Apache-2.0, BSD-2-Clause, BSD-3-Clause, + 1 more Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrConnectionLost      = errors.New("connection lost")
	ErrCanNotCreateTheRoom = errors.New("cannot create the room")
	ErrCanNotJoinTheRoom   = errors.New("cannot join the room")
	ErrNameIsAlreadyInUse  = errors.New("name is already in use")
	ErrNotAValidName       = errors.New("not a valid name")
	ErrNotAValidKey        = errors.New("not a valid key")
)

Functions

func SetLogger

func SetLogger(newLogger Logger)

Types

type Client

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

type Logger

type Logger interface {
	Print(v ...any)
	Printf(format string, v ...any)
	Println(v ...any)
}

type Registry

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

func NewRegistry

func NewRegistry() *Registry

func (*Registry) DeleteRoom

func (reg *Registry) DeleteRoom(roomID string, managementKey string)

func (*Registry) GetRoom

func (reg *Registry) GetRoom(roomID string) *Room

func (*Registry) NewClient

func (reg *Registry) NewClient(conn WebscoketConn) (retErr error)

func (*Registry) NewRoom

func (reg *Registry) NewRoom(managementKey string) string

type Room

type Room struct {
	RoomID string

	// Creator's key
	MgtKey string
	// contains filtered or unexported fields
}

type WebscoketConn

type WebscoketConn interface {
	Close() error
	NextWriter(messageType int) (io.WriteCloser, error)
	SetPongHandler(h func(appData string) error)
	ReadMessage() (messageType int, p []byte, err error)
	SetReadDeadline(t time.Time) error
	SetReadLimit(limit int64)
	SetWriteDeadline(t time.Time) error
	WriteMessage(messageType int, data []byte) error
}

Jump to

Keyboard shortcuts

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