From 8617780ed8fe5e434ab1724e0eb066263378ac15 Mon Sep 17 00:00:00 2001 From: Robbie Trencheny Date: Mon, 10 Apr 2017 14:29:46 -0700 Subject: [PATCH] Instead of using BroadcastFilter just loop over the slice of sessions and broadcast to each one --- melody.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/melody.go b/melody.go index a1745ed..b2a77ae 100644 --- a/melody.go +++ b/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.