Search code examples
javascriptautobahnwamp-protocol

What is the AutobahnJS realm for?


Just wondering what the mysterious realm field in AutobahnJS is. From the docs, creating a connection is as follows:

var connection = new autobahn.Connection({
    url: 'ws://127.0.0.1:9000/',
    realm: 'realm1'
});

I don't set a realm server-side so what is this realm parameter for? Furthermore, it is a required field which must mean it is necessary for the connection to work. Can someone enlighten us on this?


Solution

  • A Realm is a WAMP routing and administrative domain (optionally) protected by authentication and authorization. (see https://wamp-proto.org/_static/gen/wamp_latest.html#realms-sessions-and-transports).

    A single WAMP router can manage multiple realms. Hence, the realm is required to establish a session, as the server URL alone is not sufficient to know which realm to attach the session to.

    PS: The AutobahnJS docs should talk about this .. needs improvement.