Play, Scala, and Iteratees vs. Node.js and Socket.io
brikis98.blogspot.be
brikis98.blogspot.be
http://mandubian.com/2012/08/27/understanding-play2-iteratee...
I have an weekend project that uses Play's iteratees and enumerators quite well (IMO). They act as plumbing between client events (interacting with an embedded map), fetching and writing data to Mongo and interacting with the FlightAware API. I used server-sent events instead of WebSockets.
I haven't touched the code in a while (and the API key in the repo doesn't work ;)) but I have a working prototype that tries to stay entirely async: https://github.com/ryantanner/flightsight/tree/master/app
I think the OP is correct in that Play's iteratees/enumerators are fantastic but too low-level for most applications. Play (or a third-party) need to provide a high-level abstraction so that developers can ramp up as quickly as with socket.io.
If you're really curious, I'd ask on the mailing list. The devs are pretty quick to respond. https://groups.google.com/forum/#!forum/play-framework
If you're comparing the two you have way more flexibility than you should because these are two widely divergent tools with different implications reaching beyond "easier" or "faster." I don't think people ought to even consider scala if they're considering "easy" as being a significant factor.
Scala enjoys type safety and compilation and a vast and deep sophisticated feature set, not the very least of which is inherited from the proven and storied java libraries. Node.js is a mess of shit heaped on the turd that is script-kiddy npm-land covered with int-less and unicode unsafe JavaScript.
Also, your misguided rant against node and npm rather hurts your credibility. Your argument was at least ok up until that point.
https://npmjs.org/doc/cli/npm-shrinkwrap.html
It locks in all dependencies, including dependencies of dependencies, and turtles all the way down.
1 - http://www.scala-lang.org/news/2013/11/29/announcing-scala-j...
http://assets.spring.io/wp/WebSocketBlogPost.html
and the code: https://github.com/rstoyanchev/spring-sockjs-protocol-webapp
The client connection is handled by that "WebSocket.using[String]" handler. This is just a function that takes a function which takes a Request and returns an Iteratee and an Enumerator. In Play, this is known as an Action. Actions take Requests and return Results.
You can see that in the type signature of the WebSocket class: http://www.playframework.com/documentation/2.2.x/api/scala/i...
(f: (RequestHeader) ⇒ (Enumerator[A], Iteratee[A, Unit]) ⇒ Unit)
So the client connection is not bound using implicits, it's bound when that function is actually executed. This function (f) is invoked by the router when a request comes in for that controller action. This is done using HandlerInvoker: http://www.playframework.com/documentation/2.2.x/api/scala/i...Now, my explanation is not the most eloquent nor is it really necessary to understand all of this, though it certainly helps.