neko/internal/types/session.go
Miroslav Šedivý 5d906e0a8b major refactor.
2020-11-01 16:09:48 +01:00

42 lines
898 B
Go

package types
type Session interface {
ID() string
Name() string
Admin() bool
Muted() bool
IsHost() bool
Connected() bool
Address() string
SetMuted(muted bool)
SetName(name string)
SetSocket(socket WebSocket)
SetPeer(peer Peer)
SetConnected()
Disconnect(reason string) error
Send(v interface{}) error
SignalAnswer(sdp string) error
}
type SessionManager interface {
New(id string, admin bool, socket WebSocket) Session
Get(id string) (Session, bool)
Has(id string) bool
Destroy(id string) error
HasHost() bool
SetHost(host Session)
GetHost() Session
ClearHost()
Admins() []Session
Members() []Session
Broadcast(v interface{}, exclude interface{}) error
OnHost(listener func(session Session))
OnHostCleared(listener func(session Session))
OnDestroy(listener func(id string))
OnCreated(listener func(session Session))
OnConnected(listener func(session Session))
}