An implementation of SockJS for Java using JBoss Netty. It is currently not finished and not production ready. However, all transports offered by SockJS have been implemented and the issues remaining are minor.
Currently passes all tests from the 0.3.3 protocol specification except for
Only users behind HAProxy should be impacted by that though.
What is SockJS?
Under the hood SockJS tries to use native WebSockets first. If that fails it can use a variety of browser-specific transport protocols and presents them through WebSocket-like abstractions.
SockJS is intended to work for all modern browsers and in environments which don't support WebSocket protcol, for example behind restrictive corporate proxies.
Read more at http://sockjs.org
sockjs-netty is packaged as a library for JBoss Netty and not as a standalone server. Rather than installing a prepackaged JAR, you are required to include it as you would with any other Java library.
Intention is to make it available through Maven Central once it is stable enough. But right now you will have to build it from source with Maven:
That will output a JAR inside the
Running the test server
Right now everything is packaged as a library rather than a ready-to-run server. But there is a test server included that serves as an example and is also used for verifying the tests provided by the SockJS project.
Until a prebuilt Java binary, a JAR, is shipped you'll need to compile and run the project with Maven. (Maven is a Java build tool used by the project).
Running the server:
- Install Maven (Download it, 3.x should be fine, even 2.x. Or use your favorite package manager)
- Clone the project
mvn exec:java -Dexec.mainClass="com.cgbystrom.sockjs.TestServer" -Dexec.classpathScope=test -efrom your cloned project directory.
Currently, not all tests provided by the SockJS protocol pass. As mentioned, it is still work in progress and the goal is naturally to be 100% compatible with the protocol. The tests currently not passing are the ones testing Web Socket edge cases.