Request Trial

JavaScript and other clients

Yes you can use a lot of languages with connectanum


» Next - How do I get it

Browser - Server - Java Client communication

The browser is the key technology of the most web driven software solutions. Connectanum targets web based applications like SaaS products, IoT solutions, browser games, native apps, hybrid apps and web apps. To achieve a high performing and secure communication with the connectanum router, the use of autobahn|js is recommended.

Features that are not implemented to autobahn|js for full connectanum support are:

Those features have already been requested and will get implemented soon.

Example code

The original website of autobahn|js has great examples on how to connect to a router like connectanum. It misses out on how to connect in a secure way. The following example shows how to do it:

var username = "someName";
var password = "fajing382o32";
var connection = autobahn.Connection({
    url:"wss://connectanum.konsultaner.de:8443/wamp",
    realm:"de.konsultaner.middleware.demo",
    authmethods:["wampcra"],
    authid: username,
    onchallenge: (function (password) {
        return function (session, method, extra) {
            if (method === "wampcra") {
                return autobahn.auth_cra.sign(
                    autobahn.auth_cra.derive_key(password || "", extra.salt,extra.iterations,extra.keylen),
                    extra.challenge
                );
            }
        }
    })(password)
});

connection.onopen = function(session){};
connection.onclose = function(reason,details){};

This short piece of code does everything to open a secure connection by calling the autobahn.Connection method. The url of the option map is the url of the router. The realm is the scope of the connection. The router can provide multiple realms that work independently from each other. It is possible to offer multiple ways of authentications. All authentication methods that are supported by the browser client should be listed within the authmethods field of the option map. The authid is the username, key, email address or what ever is used to identify the coming up session by name. The onchallenge field holds the callback if a challenge (the second factor in the two factor authentication) is required and needs to be answered.

The session object is the instance that will provide all call, publish, registration and subscribe logic. It's necessary to store it when the onopen event is called.


Where to use Get started The router The java client JavaScript and other clients