Skip to content

Commit

Permalink
Instead of using BroadcastFilter just loop over the slice of sessions…
Browse files Browse the repository at this point in the history
… and broadcast to each one
  • Loading branch information
robbiet480 committed Apr 10, 2017
1 parent 0ded2b7 commit 8617780
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions melody.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 8617780

Please sign in to comment.