我正在尝试在HTML5客户端中使用Kaazing库。我已经在Java客户端中实现了它,并且可以正常工作。看来LoginHandler有问题。当我调试代码时,它在LoginHandler中以无限循环结束。行回调(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);
        }


任何帮助将不胜感激!

问候
安吉拉

最佳答案

用户名和密码组合是否可能不正确,从而使客户端受到重新挑战?

09-30 10:17