-
-
Save jto/6065207 to your computer and use it in GitHub Desktop.
Very simple #ServerSentEvent (#SSE) example
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.mvc._ | |
import play.api.libs.EventSource | |
import play.api.libs.iteratee._ | |
object Application extends Controller { | |
val events = Enumerator.repeat("0") | |
def index = Action { | |
Ok.stream((events &> Enumeratee.take(10) &> EventSource()) >>> Enumerator.eof) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment