Kaazing,AngularJS & BasicChallengeHandler

Kaazing, AngularJS & BasicChallengeHandler

我正在尝试在我们的 HTML5 客户端中使用 Kaazing 库。我已经在 java 客户端中实现了它并且它起作用了。 LoginHandler 似乎有问题。当我调试代码时,它在 LoginHandler 中以无限循环结束。 callback(new PasswordAuthentication(usr, pwd)) 行被一遍又一遍地调用:

// Configure a Basic Challenge Handler
var basicHandler = new BasicChallengeHandler();
  basicHandler.loginHandler = function(callback) {
  callback(new PasswordAuthentication(usr, pwd));
}

JmsConnectionProperties jmsProps = new JmsConnectionProperties();
jmsProps.connectionTimeout = 1000000;
jmsProps.reconnectAttemptsMax = -1;
jmsProps.reconnectDelay = 3000;
jmsProps.shutdownDelay = 5000;

console.log("Connect to: " + url);

// Create Connection Factory
jmsConnectionFactory = new JmsConnectionFactory(url, jmsProps);
websocketFactory = jmsConnectionFactory.getWebSocketFactory();
websocketFactory.setChallengeHandler(basicHandler);

// reate Connection future handler for the result
try {
    if (connection == null) {
        var connectionFuture = jmsConnectionFactory.createConnection( function() {
            try {
                // never comes to this line!!!
                connection = connectionFuture.getValue();
                // DO SOME STUFF

                    } catch (e) {
                        console.dir(e);
                        // alert(e.message);
                    }
                });
            } else {
                try {
                    connection.close(function() { /* Closed */
                    });
                } finally {
                    connection = null;
                }
            }
        } catch (ex) {
            console.dir(ex);
        }

任何帮助将不胜感激!

问候 安吉拉

会不会是用户名和密码组合不正确,导致重新挑战客户端?