小编Joh*_*wby的帖子

传递给JS客户端reconnectionStrategy的原因不明的参数

我正在研究Diffusion JS API的一些代码示例,但我不了解重新连接的示例.reconnectionStrategy有哪些start和哪些abort参数?

// Create a reconnection strategy that applies an exponential back-off
var reconnectionStrategy = (function() {
    return function(start, abort) {
        var wait = Math.min(Math.pow(2, attempts++) * 100, maximumAttemptInterval);

        // Wait and then try to start the reconnection attempt
        setTimeout(start, wait);
    };
})();

// Connect to the server.
diffusion.connect({
    host : 'diffusion.example.com',
    port : 443,
    secure : true,
    principal : 'control',
    credentials : 'password',
    reconnect : {
        timeout : maximumTimeoutDuration,
        strategy : reconnectionStrategy
    }
}).then(function(session) …
Run Code Online (Sandbox Code Playgroud)

push-diffusion

5
推荐指数
1
解决办法
48
查看次数

标签 统计

push-diffusion ×1