Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Library for building SockJS compatible servers using Netty and the JVM.

branch: master

Sending of WS ping frames.

No browser initiates sending of ping frames according to https://en.wikipedia.org/wiki/Comparison_of_WebSocket_implementations
This is inline with observations I've seen as well.
And with no ping/pong heartbeats being sent, TCP connections tend to die quite quickly over public internet.
latest commit c88560f7c0
Carl Byström authored September 09, 2013
Octocat-spinner-32 src Sending of WS ping frames. September 09, 2013
Octocat-spinner-32 README.md Mentioned passing of tests in 0.3.3. April 16, 2013
Octocat-spinner-32 pom.xml Initial metric and session timeout support. May 21, 2013
README.md

sockjs-netty

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 test_haproxy. Only users behind HAProxy should be impacted by that though.

What is SockJS?

SockJS is a browser JavaScript library that provides a WebSocket-like object. SockJS gives you a coherent, cross-browser, Javascript API which creates a low latency, full duplex, cross-domain communication channel between the browser and the web server.

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

Installing

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:

mvn package

That will output a JAR inside the target/ folder.

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:

  1. Install Maven (Download it, 3.x should be fine, even 2.x. Or use your favorite package manager)
  2. Clone the project
  3. Run mvn exec:java -Dexec.mainClass="com.cgbystrom.sockjs.TestServer" -Dexec.classpathScope=test -e from your cloned project directory.

What's missing?

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.

Something went wrong with that request. Please try again.