Can connect but not join to crossbar (plain Java)

Hi,

I can connect to the crossbar but i can not join it, which probably happening due to unsuccessful authentification. However, i can join/publish to crossbar via python with the same authentication credentials.

Here is the code snippet:

IAuthenticator authenticator = new ChallengeResponseAuth("xxx-xxx-xxx", "xxx-xxx-xxx");
Client client = new Client(this.session, "ws://localhost:8080/ws", "realm1", authenticator);
CompletableFuture<ExitInfo> exitInfoCompletableFuture = client.connect(); 

and here is my configuration file:

- type: router
  realms:
    - name: xxx-xxx-xxx
      roles:
        - name: xxx-xxx-xxx
          permissions:
          - uri: ''
            match: prefix
            allow:
              call: true
              register: false
              publish: true
              subscribe: true
            disclose:
              caller: true
              publisher: true
            cache: true
        - name: system
          permissions:
          - uri: ''
            match: prefix
            allow:
              call: true
              register: true
              publish: true
              subscribe: true
            disclose:
              caller: true
              publisher: true
            cache: true

  transports:
    # For User Apps (on Devices)
    - type: websocket
      endpoint:
        type: tcp
        port: 8088
      auth:
        wampcra:
          type: dynamic               ####### in demogallery example the type is static######
          authenticator:auth.authenticate_userapp
      options:
        compression:
          deflate:
            request_no_context_takeover: false
            request_max_window_bits: 11
            no_context_takeover: false
            max_window_bits: 11
            memory_level: 4
        validate_utf8: false
        enable_webstatus: true
        open_handshake_timeout: 4000
        close_handshake_timeout: 3000
        auto_fragment_size: 65536
        auto_ping_interval: 10000
        auto_ping_timeout: 5000
        auto_ping_size: 4
    - type: websocket
      endpoint:
        type: tcp
        port: 8089      
      auth:
        wampcra:
          type: static
          users:
            system:
              secret: xxx-xxx-xxx
              role: system
      options:
        compression:
          deflate:
            request_no_context_takeover: false
            request_max_window_bits: 11
            no_context_takeover: false
            max_window_bits: 11
            memory_level: 4
        validate_utf8: false
        enable_webstatus: true
        open_handshake_timeout: 4000
        close_handshake_timeout: 3000
        auto_fragment_size: 65536
        auto_ping_interval: 10000
        auto_ping_timeout: 5000
        auto_ping_size: 4

I can not manage to get descriptive logs, therefore, have no clue what exactly going on or how to debug it properly.

Regards
Bilal

So it seems the issue was with our NettyWebSocket transport. For quick experimenting you could remove the compression stanza from your crossbar config and you should have everything working.

I have created a PR to address the underlying issue

Hi Omer,

thanks for the quick reply… i followed your instructions and removed the compression stanza but unfortunately could not even connect to the crossbar after removing it… for reference i have attached the screenshots:

this one is with compression:

after connecting it stays connected

i removed following lines from the config file:

compression:
deflate:
request_no_context_takeover: false
request_max_window_bits: 11
no_context_takeover: false
max_window_bits: 11
memory_level: 4

sorry, i was allowed to put only one image in the post.

so this one is without compression:

after connecting it gets disconnect…

413 [nioEventLoopGroup-2-1] DEBUG io.netty.util.Recycler - -Dio.netty.recycler.ratio: 8

Connected

705 [nioEventLoopGroup-2-1] DEBUG io.netty.handler.codec.http.websocketx.WebSocket08FrameEncoder - Encoding WebSocket Frame opCode=2 length=132

738 [nioEventLoopGroup-2-1] DEBUG io.netty.handler.codec.http.websocketx.WebSocket08FrameDecoder - Decoding WebSocket Frame opCode=2

738 [nioEventLoopGroup-2-1] DEBUG io.netty.handler.codec.http.websocketx.WebSocket08FrameDecoder - Decoding WebSocket Frame length=56

io.crossbar.autobahn.wamp.types.CloseDetails@46663cca

Sep 17, 2020 3:25:30 PM io.crossbar.autobahn.wamp.transports.NettyWebSocketClientHandler

INFO: WebSocket Client disconnected!

Session with ID=0, disconnected.

1832 [nioEventLoopGroup-2-1] DEBUG io.netty.channel.nio.NioEventLoop - Selector.select() returned prematurely 9 times in a row for Selector

If it gets disconnected after connecting there are two places you could look into.

  • Check the reason in the CloseDetails object that gets passed with OnLeaveListener
  • Run crossbar with --loglevel debug to see what caused the disconnect.

Hi Omer,

thanks for your help. Actually removing the compression stanza did work yesterday.