Created
February 10, 2012 21:16
-
-
Save lucastorri/1792941 to your computer and use it in GitHub Desktop.
Simple echo Controller in Play framework 2.0
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
package controllers | |
import play.api.libs.iteratee._ | |
object Application extends Controller { | |
def echo = WebSocket.using[String] { request => | |
val out = Enumerator.imperative[String]() | |
val in = Iteratee.foreach[String](out.push(_)).mapDone(_ => println("Disconnected")) | |
(in, out) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment