Cannot switch from ws:// to wss:// in android

When I connect to ws:// it works. When I add TLS on crossbar and connect to wss:// it doesn’t. I am using the following to connect:

import io.crossbar.autobahn.wamp.Client;
import io.crossbar.autobahn.wamp.Session;
import io.crossbar.autobahn.wamp.auth.TicketAuth;

Session session = null;
Client client = null;

session = new Session();
session.addOnConnectListener(this::onConnectListener);
session.addOnJoinListener(this::onJoinListener);
session.addOnLeaveListener(this::onLeaveListener);
session.addOnDisconnectListener(this::onDisconnectListener);
session.addOnReadyListener(this::onReadyListener);
IAuthenticator authenticator = new TicketAuth(_user,_key);    
client = new Client(session, "wss://x.x.x.x:9000/ws_level1_auth", "myrealm", authenticator);
CompletableFuture<ExitInfo> exitFuture = client.connect();
exitFuture.whenComplete((exitCode, throwable) -> { });

All it does is trigger the disconnect callback. Am I doing something wrong? What can I do? Note that this is a self-signed cert. Is it possible that there is something I need to allow in Android? I know the TLS itself is working because I can get the wamp test page through the browser at https://x.x.x.x:9000/ws_level1_auth.

Can you provide the the crossbar config and the way you are generating the self-signed certificate. I want to reproduce the issue and get the required logs. That will help me find a fix quickly

One thing I noticed right away in my config when comparing with the TLS sample config is that there was a tls config in the transport section and also a transport config with tls config in the components section. I don’t have the transport in the components section. Could this be the issue?

Right now I want to get tls going on port 9000:

{
    "$schema": "https://raw.githubusercontent.com/crossbario/crossbar/master/crossbar.json",
    "version": 2,
    "controller": {
    },
    "workers": [
        {
            "type": "router",
            "options": {
                "pythonpath": [
                    "..",
                    "../../web",
                    "../../crossbar"
                ]
            },
            "realms": [
                {
                    "name": "myrealm",
                    "roles": [
                        {
                            "name": "anonymous",
                            "permissions": [
                                {
                                    "uri": "",
                                    "match": "prefix",
                                    "allow": {
                                        "call": true,
                                        "register": true,
                                        "publish": true,
                                        "subscribe": true
                                    },
                                    "disclose": {
                                        "caller": true,
                                        "publisher": true
                                    },
                                    "cache": true
                                }
                            ]
                        },
                        {
                            "name": "level2_auth",
                            "permissions": [
                                {
                                    "uri": "biz.myapp.tw_p_level2_",
                                    "match": "prefix",
                                    "allow": {
                                        "call": true,
                                        "register": false,
                                        "publish": false,
                                        "subscribe": false
                                    },
                                    "disclose": {
                                        "caller": true,
                                        "publisher": false
                                    },
                                    "cache": true
                                }
                            ]
                        },
                        {
                            "name": "external-client",
                            "permissions": [
                                {
                                    "uri": "biz.myapp.group_subscription_",
                                    "match": "prefix",
                                    "allow": {
                                        "call": false,
                                        "register": false,
                                        "publish": false,
                                        "subscribe": true
                                    },
                                    "disclose": {
                                        "caller": true,
                                        "publisher": true
                                    },
                                    "cache": true
                                },
                                {
                                    "uri": "biz.myapp.tw_b_",
                                    "match": "prefix",
                                    "allow": {
                                        "call": true,
                                        "register": false,
                                        "publish": false,
                                        "subscribe": false
                                    },
                                    "disclose": {
                                        "caller": true,
                                        "publisher": true
                                    },
                                    "cache": true
                                },
                                {
                                    "uri": "biz.myapp.cc_f_",
                                    "match": "prefix",
                                    "allow": {
                                        "call": true,
                                        "register": false,
                                        "publish": false,
                                        "subscribe": false
                                    },
                                    "disclose": {
                                        "caller": true,
                                        "publisher": true
                                    },
                                    "cache": true
                                }
                            ]
                        },
                        {
                            "name": "backoffice",
                            "permissions": [
                                {
                                    "uri": "",
                                    "match": "prefix",
                                    "allow": {
                                        "call": true,
                                        "register": true,
                                        "publish": true,
                                        "subscribe": true
                                    },
                                    "disclose": {
                                        "caller": true,
                                        "publisher": true
                                    },
                                    "cache": true
                                }
                            ]
                        },
                        {
                            "name": "authenticator",
                            "permissions": [
                                {
                                    "uri": "biz.myapp.django_authenticate",
                                    "match": "exact",
                                    "allow": {
                                        "call": false,
                                        "register": true,
                                        "publish": false,
                                        "subscribe": false
                                    },
                                    "disclose": {
                                        "caller": true,
                                        "publisher": true
                                    },
                                    "cache": true
                                }
                            ]
                        },
                        {
                            "name": "l2authenticator",
                            "permissions": [
                                {
                                    "uri": "biz.myapp.level2_authenticate",
                                    "match": "exact",
                                    "allow": {
                                        "call": false,
                                        "register": true,
                                        "publish": false,
                                        "subscribe": false
                                    },
                                    "disclose": {
                                        "caller": true,
                                        "publisher": true
                                    },
                                    "cache": true
                                }
                            ]
                        }
                    ]
                }
            ],
            "transports": [
                {
                    "type": "web",
                    "endpoint": {
                        "type": "tcp",
                        "port": 9000,
                        "tls": {
                            "key" : "server_key.pem",
                            "certificate" : "server_cert.pem"
                        }
                    },
                    "paths": {
                        "ws_level1_auth": {
                            "type": "websocket",
                            "auth": {
                                "ticket": {
                                    "type": "dynamic",
                                    "authenticator": "biz.myapp.django_authenticate"
                                }
                            }
                        },
                        "ws_level2_auth": {
                            "type": "websocket",
                            "auth": {
                                "ticket": {
                                    "type": "dynamic",
                                    "authenticator": "biz.myapp.level2_authenticate"
                                }
                            }
                        }

                    }
                },
                {
                    "type": "web",
                    "endpoint": {
                        "type": "tcp",
                        "port": 9001
                    },
                    "paths": {
                        "ws_static_auth": {
                            "type": "websocket",
                            "auth": {
                                "wampcra": {
                                    "type": "static",
                                    "users": {
                                        "user1": {
                                            "secret": "pass1",
                                            "role": "backoffice"
                                        },
                                        "user2": {
                                            "secret": "pass2",
                                            "role": "backoffice"
                                        },
                                        "user3": {
                                            "secret": "pass3",
                                            "role": "backoffice"
                                        },
                                        "user4": {
                                            "secret": "pass4",
                                            "role": "backoffice"
                                        },
                                        "user5": {
                                            "secret": "pass5",
                                            "role": "backoffice"
                                        },
                                        "user6": {
                                            "secret": "pass6",
                                            "role": "backoffice"
                                        },
                                        "user7": {
                                            "secret": "pass7",
                                            "role": "backoffice"
                                        },
                                        "user8": {
                                            "secret": "pass8",
                                            "role": "backoffice"
                                        },
                                        "user9": {
                                            "secret": "pass9",
                                            "role": "backoffice"
                                        },
                                        "user10": {
                                            "secret": "pass10",
                                            "role": "backoffice"
                                        },
                                        "user11": {
                                            "secret": "pass11",
                                            "role": "backoffice"
                                        },
                                        "user12": {
                                            "secret": "pass12",
                                            "role": "backoffice"
                                        },
                                        "user13": {
                                            "secret": "pass13",
                                            "role": "backoffice"
                                        },
                                        "user14": {
                                            "secret": "pass14",
                                            "role": "backoffice"
                                        },
                                        "user15": {
                                            "secret": "pass15",
                                            "role": "backoffice"
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            ],
            "components": [
                {
                    "type": "class",
                    "classname": "level2_authenticator.AuthenticatorSession",
                    "realm": "myrealm",
                    "role": "l2authenticator"
                },
                {
                    "type": "class",
                    "classname": "django_authenticator.AuthenticatorSession",
                    "realm": "myrealm",
                    "role": "authenticator"
                },
                {
                    "type": "class",
                    "classname": "backend.BackendSession",
                    "realm": "myrealm",
                    "role": "backoffice"
                }
            ]
        }
    ]
}

When I try to configure the transport in the container, I get the following error:

2021-08-19T12:23:50-0400 [Controller   6639] Invalid node configuration
2021-08-19T12:23:50-0400 [Controller   6639] invalid component configuration - encountered unknown attribute 'transport'