diff --git a/examples/broadcast/main.go b/examples/broadcast/main.go index eb592de..273103d 100644 --- a/examples/broadcast/main.go +++ b/examples/broadcast/main.go @@ -35,7 +35,6 @@ func main() { return false }) } - }) m.HandleSentMessage(func(session *melody.Session, bytes []byte) { diff --git a/melody.go b/melody.go index 50fcc40..c7b0337 100644 --- a/melody.go +++ b/melody.go @@ -317,6 +317,18 @@ func FormatCloseMessage(closeCode int, text string) []byte { } // extends + +func (m *Melody) Channels() map[string]*Channel { + return m.hub.channels +} + +func (m *Melody)Channel(name string) *Channel { + if ch, ok := m.hub.channels[name]; ok { + return ch + } + return nil +} + func (m *Melody) Subscribe(s *Session, c string) error { if m.hub.closed() { return errors.New("melody instance is already closed")