Created
April 2, 2015 14:52
-
-
Save dat-vikash/2ae6abfc9e6cf70c7660 to your computer and use it in GitHub Desktop.
Play 2.2.x WebSocketChannel trait
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* This trait allows websocket classes to push messages to client via a concurrent channel */ | |
trait WebSocketChannel | |
{ | |
//instantiate an Enumerator and Channel | |
val (out,channel) = Concurrent.broadcast[JsValue] | |
// method to allow pushing of data up the channel | |
def push(data: JsValue) = channel.push(data) | |
def cleanSocketResources() = channel.end() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment