olahol / melody

:notes: Minimalist websocket framework for Go
BSD 2-Clause "Simplified" License
3.75k stars 366 forks source link

why the comunication chan is sync, not async #61

Closed yiippee closed 2 years ago

yiippee commented 5 years ago

In your code: func newHub() hub { return &hub{ sessions: make(map[Session]bool), broadcast: make(chan envelope), register: make(chan Session), unregister: make(chan Session), exit: make(chan envelope), open: true, rwmutex: &sync.RWMutex{}, } }

But I thank " broadcast: make(chan *envelope, 1024) " is better, or I misunderstand something. Thanks for your project.