Browse Source

Instead of using BroadcastFilter just loop over the slice of sessions and broadcast to each one

master
Robbie Trencheny 8 years ago
parent
commit
8617780ed8
No known key found for this signature in database GPG Key ID: 57406F414538A33B
  1. 10
      melody.go

10
melody.go

@ -234,12 +234,12 @@ func (m *Melody) BroadcastOthers(msg []byte, s *Session) error {
// BroadcastMultiple broadcasts a text message to multiple sessions given in the sessions slice.
func (m *Melody) BroadcastMultiple(msg []byte, sessions []*Session) error {
return m.BroadcastFilter(msg, func(q *Session) bool {
for _, sess := range sessions {
return sess == q
for _, sess := range sessions {
if writeErr := sess.Write(msg); writeErr != nil {
return writeErr
}
return false
})
}
return nil
}
// BroadcastBinary broadcasts a binary message to all sessions.

Loading…
Cancel
Save