title: Private Chat Application using Play 2.3 Websocket
body: <p>I am working on a Chat application using WebSockets(in Play 2.3 with scala). The message has to be broadcasted to all users or specific set of users based on the incoming message.  One user can participate in more than one group chat and able to chat with individuals simultaneously.</p>
  
  <p>The <code>Concurrent.broadcast[JsValue]</code> returns the tuple<code>(enumerator, channel)</code>. I dont know how to apply filter to this channel, so only specific group of clients will get the message.</p>
  
  <p>We can apply filters on enumerator like
  (enumerator &amp;> Enumeratee.filter[JsValue] {...} ). but we can not push messages via this enumerator.</p>
  
  <p>I don't want to parse the message on the client side.
  My code looks like this,</p>
  
  <pre><code>val (public_enumerator, public_channel) = Concurrent.broadcast[JsValue]
  
  def chat = WebSocket.using[JsValue] { request =&gt;
  
         val in = Iteratee.foreach[JsValue]{ msg =&gt;
  
              public_channel.push(msg)
  
          }.map { _ =&gt;
  
              // Quit connection
          }
          (in ,public_enumerator)
  }
  </code></pre>
  
  <p>Most of the examples I found online are using the deprecated methods, some of them removed in Play 2.3 (like Enumerators.imperative). I dont know how <code>Concurrent.unicast</code> works.</p>
  
  <p>I would like to know if there is another way of doing the same using Actors. I also like to know, that, this design will handle the higher load( more than 1000 users). Thank you.</p>