Intended for Scala and Akka developers
Socko enables you to expose your Akka actors as HTTP or WebSocket endpoints.
Socko includes a StaticFileProcessor Akka actor that serves static files. We use this to serve our HTML5 application files.
We did consider using an existing Scala web servers. Here’s why they did not suit our needs:
- Play2, Lift, Xitrum, Sweet - we do not need a server based web application framework.
- Play2-mini - a bit too heavyweight as of version 1 because it pulls in all of Play.
- Spray, Unfiltered - we want WebSocket support; would like future support for SPDY and perhaps STOMP.
- Scalatra - we do not want to have to use a servlet container.
We are not saying that any of the above great frameworks are in anyway bad.
What we are saying is they did not exactly fit the requirements of our mashupbots project. With our existing knowledge of Netty, we thought it was quicker for us to build Socko than to modify/enhance an existing project to suite our needs.
Socko runs within your Scala application. It is not a standalone web server.
You can configure Socko from inside your code and/or via settings in Akka’s configuration file.
You can also start more than web server instance in your application; bound to different ports. This is useful if you have APIs that you wish to publish on different network interfaces; for example a public API and a private administraion/monitoring API.
Lightweight (assuming you are already using Akka)
The core socko-webserver module in the upcoming V0.3 has less than 2562 lines of code.
Supportive of HTTP and HTML5 Standards
HTTP streaming (i.e. “chunked” transfer encoding)
HTTP/1.1 persistant connections (keep-alive)
HTTP headers, including browser static file cache headers
Decoding HTTP POST request body, file uploads and query strings
WebSockets (tested against Autobahn)
Socko handles and processes incoming HTTP requests in an asynchronous and event driven manner thanks to Netty and Akka.
Here’s some benchmarking that we’ve done with v0.2.
Socko is published under the Apache 2 license.
The source code is hosted at github.
If you have a bug fix or enhancements, please send us a github pull request. Your contribution is welcome and appreciated.