如何通知客户成功/失败订阅?

时间:2013-12-12 22:15:11

标签: autobahn

我正在订阅'队列:1.2.3'。客户如何知道他们是否已成功订阅?是否存在服务器响应客户端的机制?

下面是一个我用来测试订阅的简单程序。我不确定在服务器端显示什么。

var sess;
var wsuri = 'ws://test.lan:8000';

window.onload = function() {
    // connect to WAMP server
    ab.connect(wsuri,

        // WAMP session was established
        function (session) {
            sess = session;
            console.log("Connected to " + wsuri);
        },

        // WAMP session is gone
        function (code, reason) {
            sess = null;
            console.log("Connection lost (" + reason + ")");
        }
    );
};

function subscribe()
{
    sess.subscribe("queue:1.2.3", topicReceived)
}

function topicReceived(topicUri, event)
{
    console.log(topicUri + ' ' + event)
}

我觉得这篇文章涉及到我的问题:Calling dispatch in subscribe in Autobahn

1 个答案:

答案 0 :(得分:2)

不在WAMP v1中。确认(带有订阅ID)或订阅错误(带有错误URI)将成为当前正在烹饪的WAMPv2的一部分。