Search code examples
ajaxscalawebsocketweb-frameworks

Lightweight Real-time Ajax, WebSocket, or Similar for Scala


Our requirements for a real-time web framework include:

  • lightweight framework
  • scala support on server side
  • flexible on communication mechanism : may be Ajax, Server Sent Event or WebSocket.
  • relatively little changes required to client html.
    • E.g. using the WebSockets js library is fine
    • introducing significant compile time/server side page processing is not. E.g. Play routing annotations are not acceptable
  • must have working examples for both:
    • web clients
    • server to server communications
    • fully functional build. Preferably sbt, but maven maybe acceptable

I have evaluated the following frameworks: and each one of them has one or more drawbacks that make usage within our application less than desirable.

  • Play: somewhat heavy, but more importantly it introduces custom annotations/processing into the html page. We need VANILLA html pages.

  • Spray: closer to the mark. But although I found a number of example applications, the actor-based communication is not working in those examples. The SimpleServer example has a built-in "cases" counter (from SimpleClient) that do not work as given: they could certainly be made to work .. eventually..

  • atmosphere: lacking examples

    • jetty, netty: lacked fully functional examples buildable within sbt or maven
  • socko : The markdown essentially stipulates using eclipse/scala-IDE for running tests/doing development. That is a non-starter for us (IJ shop). It was unclear how to run examples and/or start their servers from sbt / command line.


Solution

  • I ended up writing a fair amount of custom code wrapped around Netty. After it is in better shape I may drop it on GitHub.