mirror of
https://github.com/m1k1o/neko.git
synced 2024-07-24 14:40:50 +12:00
47 lines
1.1 KiB
Go
47 lines
1.1 KiB
Go
package types
|
|
|
|
type Member struct {
|
|
ID string `json:"id"`
|
|
Name string `json:"displayname"`
|
|
Admin bool `json:"admin"`
|
|
Muted bool `json:"muted"`
|
|
}
|
|
|
|
type Session interface {
|
|
ID() string
|
|
Name() string
|
|
Admin() bool
|
|
Muted() bool
|
|
Connected() bool
|
|
Member() *Member
|
|
SetMuted(muted bool)
|
|
SetName(name string) error
|
|
SetConnected(connected bool) error
|
|
SetSocket(socket WebSocket) error
|
|
SetPeer(peer Peer) error
|
|
Address() string
|
|
Kick(message string) error
|
|
Send(v interface{}) error
|
|
SignalAnswer(sdp string) error
|
|
}
|
|
|
|
type SessionManager interface {
|
|
New(id string, admin bool, socket WebSocket) Session
|
|
HasHost() bool
|
|
IsHost(id string) bool
|
|
SetHost(id string) error
|
|
GetHost() (Session, bool)
|
|
ClearHost()
|
|
Has(id string) bool
|
|
Get(id string) (Session, bool)
|
|
Members() []*Member
|
|
Admins() []*Member
|
|
Destroy(id string) error
|
|
Broadcast(v interface{}, exclude interface{}) error
|
|
OnHost(listener func(id string))
|
|
OnHostCleared(listener func(id string))
|
|
OnDestroy(listener func(id string, session Session))
|
|
OnCreated(listener func(id string, session Session))
|
|
OnConnected(listener func(id string, session Session))
|
|
}
|