Autobahn-java still only support WAMP1 now?

#1

I try connect WAMP server:

WebSocketOptions options = new WebSocketOptions();
options.setReconnectInterval(5000);
try {
    mConnection.connect(hostname, new WebSocketConnectionHandler() {
        @Override
        public void onOpen() {
            Log.d(TAG, "open");
       }
​
        @Override
        public void onMessage(String payload) {
            Log.d(TAG, "received => " + payload);
       }
​
        @Override
        public void onClose(int code, String reason) {
            Log.d(TAG, "closed => " + reason);
       }
   }, options);
} catch (WebSocketException e) {
    e.printStackTrace();
}

but throw some error:

closed => Server error 400 (This server only speaks WebSocket subprotocols wamp.2.cbor.batched, wamp.2.cbor, wamp.2.msgpack.batched, wamp.2.msgpack, wamp.2.ubjson.batched, wamp.2.ubjson, wamp.2.json.batched, wamp.2.json)

Is autobahn-java only support WAMP1 or other configuration required?

0 Likes

#2

Hi!

Actually autobahn-java is WAMPv2 only, it does not support WAMPv1.

The problem with your code is that you are trying to make a WebSocket connection are expecting it to talk WAMPv2 :slight_smile:

Please take a look at this example code example https://github.com/crossbario/autobahn-java#connecting-the-dots or explore a more detailed set of examples here https://github.com/crossbario/autobahn-java/blob/master/demo-gallery/src/main/java/io/crossbar/autobahn/demogallery/ExampleClient.java

HTH,

Cheers!

···

On Wednesday, October 3, 2018 at 7:31:25 AM UTC+5, pushy...@gmail.com wrote:

I try connect WAMP server:

WebSocketOptions options = new WebSocketOptions();
options.setReconnectInterval(5000);
try {
    mConnection.connect(hostname, new WebSocketConnectionHandler() {
        @Override
        public void onOpen() {
            Log.d(TAG, "open");
       }
​
        @Override
        public void onMessage(String payload) {
            Log.d(TAG, "received => " + payload);
       }
​
        @Override
        public void onClose(int code, String reason) {
            Log.d(TAG, "closed => " + reason);
       }
   }, options);
} catch (WebSocketException e) {
    e.printStackTrace();
}

but throw some error:

closed => Server error 400 (This server only speaks WebSocket subprotocols wamp.2.cbor.batched, wamp.2.cbor, wamp.2.msgpack.batched, wamp.2.msgpack, wamp.2.ubjson.batched, wamp.2.ubjson, wamp.2.json.batched, wamp.2.json)

Is autobahn-java only support WAMP1 or other configuration required?

0 Likes

#3

Thanks for your reply!!!

在 2018年10月3日星期三 UTC+8下午3:13:28,Omer Akram写道:

···

Hi!

Actually autobahn-java is WAMPv2 only, it does not support WAMPv1.

The problem with your code is that you are trying to make a WebSocket connection are expecting it to talk WAMPv2 :slight_smile:

Please take a look at this example code example https://github.com/crossbario/autobahn-java#connecting-the-dots or explore a more detailed set of examples here https://github.com/crossbario/autobahn-java/blob/master/demo-gallery/src/main/java/io/crossbar/autobahn/demogallery/ExampleClient.java

HTH,

Cheers!

On Wednesday, October 3, 2018 at 7:31:25 AM UTC+5, pushy...@gmail.com wrote:

I try connect WAMP server:

WebSocketOptions options = new WebSocketOptions();
options.setReconnectInterval(5000);
try {
    mConnection.connect(hostname, new WebSocketConnectionHandler() {
        @Override
        public void onOpen() {
            Log.d(TAG, "open");
       }
​
        @Override
        public void onMessage(String payload) {
            Log.d(TAG, "received => " + payload);
       }
​
        @Override
        public void onClose(int code, String reason) {
            Log.d(TAG, "closed => " + reason);
       }
   }, options);
} catch (WebSocketException e) {
    e.printStackTrace();
}

but throw some error:

closed => Server error 400 (This server only speaks WebSocket subprotocols wamp.2.cbor.batched, wamp.2.cbor, wamp.2.msgpack.batched, wamp.2.msgpack, wamp.2.ubjson.batched, wamp.2.ubjson, wamp.2.json.batched, wamp.2.json)

Is autobahn-java only support WAMP1 or other configuration required?

0 Likes