hub

package
v0.0.0-...-d73b14a Latest Latest
Warning

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

Go to latest
Published: Feb 8, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Event = struct {
	Start        string
	Restart      string
	Vote         string
	Watch        string
	Watching     string
	UserLeft     string
	ObserverLeft string
}{
	"START",
	"RESTART",
	"VOTE",
	"WATCH",
	"WATCHING",
	"USER_LEFT",
	"OBSERVER_LEFT",
}

Functions

This section is empty.

Types

type Hub

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

func (*Hub) Connect

func (p *Hub) Connect(store *db.Store)

func (*Hub) Emit

func (p *Hub) Emit(session string, data string) error

func (*Hub) EmitLocal

func (p *Hub) EmitLocal(session string, data string)

func (*Hub) HandleWebSockets

func (p *Hub) HandleWebSockets(url string)

func (*Hub) Release

func (p *Hub) Release()

func (*Hub) Subscribe

func (p *Hub) Subscribe(sock *glue.Socket, sessionId string) error

type IHub

type IHub interface {
	Connect(store *db.Store)
	HandleWebSockets(url string)
	Emit(session string, data string) error
	EmitLocal(session string, data string)
	Release()
}

type VoidHub

type VoidHub struct {
	Emitted      []string
	LocalEmitted []string
}

A hub implementation used for testing. Poor man's mockery.

Feel free to mock this.
Or fake outrage.

I can do this all day.

func (*VoidHub) Connect

func (p *VoidHub) Connect(db *db.Store)

This VOID version resets the state

func (*VoidHub) Emit

func (p *VoidHub) Emit(session string, data string) error

func (*VoidHub) EmitLocal

func (p *VoidHub) EmitLocal(session string, data string)

func (*VoidHub) HandleWebSockets

func (p *VoidHub) HandleWebSockets(url string)

func (*VoidHub) Release

func (p *VoidHub) Release()

Jump to

Keyboard shortcuts

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