Skip to content

jachzen/autobahn-java

Repository files navigation

Autobahn|Java

Under Development

Autobahn|Java is a subproject of the Autobahn project and provides open-source client implementations for

running on Android and Netty/JVM.

The WebSocket layer is using a callback based user API.

The WAMP layer is using Java CompletableFuture for WAMP actions (call, register, publish and subscribe) and the Observer pattern for WAMP session, subscription and registration lifecycle events.

The library is MIT licensed, maintained by the Crossbar.io Project, tested using the AutobahnTestsuite and published as a JAR to Maven and as a Docker toolchain image to Dockerhub.

Show me some code

Here is a simple WebSocket echo client:

private final WebSocketConnection mConnection = new WebSocketConnection();

private void start() {

   final String wsuri = "ws://localhost:9000";

   try {
      mConnection.connect(wsuri, new WebSocketHandler() {

         @Override
         public void onOpen() {
            Log.d(TAG, "Status: Connected to " + wsuri);
            mConnection.sendTextMessage("Hello, world!");
         }

         @Override
         public void onTextMessage(String payload) {
            Log.d(TAG, "Got echo: " + payload);
         }

         @Override
         public void onClose(int code, String reason) {
            Log.d(TAG, "Connection lost.");
         }
      });
   } catch (WebSocketException e) {

      Log.d(TAG, e.toString());
   }
}

Get in touch

Get in touch on IRC #autobahn on chat.freenode.net or join the mailing list.

About

WebSocket & WAMP in Java for Android and Java 8

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Java 96.5%
  • Python 2.1%
  • Other 1.4%