voryx/angular-wamp

connection alternatives

Opened this issue · 3 comments

Is it possible to provide connection alternatives, so if one WAMP-Router is unreachable a connection attempt to another is made?

AutobahnJS seems to provide something like this with transports:

transports: [
      {
         'type': 'websocket',
         'url': 'ws://127.0.0.1:9000/ws'
      },
      {
         'type': 'longpoll',
         'url': 'http://127.0.0.1:9000/lp'
      }
   ],

but if I set these options just connection attempts to the first one will be made.

@veastark I don't see why that wouldn't work. The options in $wampProvider are passed on to autobhan.

$wampProvider.init({
    transports: [
        {
            'type': 'websocket',
            'url': 'ws://127.0.0.1:9000/ws'
        },
        {
            'type': 'longpoll',
            'url': 'http://127.0.0.1:9000/lp'
        }
    ]
    //Any other AutobahnJS options
});

I'll test this out later today.

Well if i try it in my code it will only try to connect to the first router:

ESHLApp.config(function ($wampProvider) {    

    $wampProvider.init({
        transports: [
        {
            'type': 'websocket',
            'url': 'ws://xxx:8080/ws'
        },
        {
            'type': 'websocket',
            'url': 'wss://yyy:8888/ws'
        }
        ],
        realm: 'eshl', //real
        //Any other AutobahnJS options
    });
}).run(function ($wamp) {
    $wamp.open();
});

Firefox can't establish a connection to the server at ws://xxx:8080/ws.
http://localhost:34873/resources/scripts/autobahnjs-0.9.5/autobahn.min.js
Line 184
Connection Closed: unreachable Object { retry_delay=1.5649586816915426, retry_count=1, will_retry=true, more...}
angular.min.js (line 453)

Can you provide your crossbar config?