0

你好,我尝试理解这个库,我在这里有一个 python 源https://github.com/ig-python/ig-markets-api-python-library/blob/master/trading_ig/lightstreamer.py 在第 187 行我'我能够添加 LS_op2 或设置 LS_container 但我在 js 版本上执行此操作时遇到问题。

我想要的第一条信息是:

LS_op2=create&LS_phase=5701&LS_cause=new.api&LS_polling=true&LS_polling_millis=0&LS_idle_millis=0&LS_cid=pcYgxn8m8 feOojy*****f3g2.pz479mDv&LS_adapter_set=DEMO&LS_container=lsc&

但我只得到

LS_phase=3201&LS_cause=new.nullresp&LS_polling=true&LS_polling_millis=0&LS_idle_millis=0&LS_cid=pcYgxn*** feOojyA1U661i3g2.pz47Af6k&LS_adapter_set=DEMO&

也许有人有想法,这是我的来源,谢谢。

  <html>
<head>
    <script src="https://unpkg.com/lightstreamer-client-web@8.0.3/lightstreamer.min.js"></script>
    <script>
        document.addEventListener("DOMContentLoaded", function(event) {
            var client = new LightstreamerClient("https://push.lightstreamer.com","DEMO");

            client.connect();
            var sub = new Subscription("MERGE",["item1","item2","item3"],["stock_name","last_price"]);
            sub.setDataAdapter("QUOTE_ADAPTER");
            sub.setRequestedSnapshot("yes");

            sub.addListener({
                onItemUpdate: function(obj) {
                   console.log(obj.getValue("stock_name") + ": " + obj.getValue("last_price"));
                }
            });
            client.subscribe(sub);
        });

    </script>
</head>
<body>
</body>
</html>
4

1 回答 1

0

如果问题是为什么 Lightstreamer javascript SDK 8.0.3 库会创建不同的请求,那是因为作为参考提供的 python 代码(不依赖于任何 SDK 库)使用了早期版本的通信协议。无论如何,javascript库发出的请求应该可以工作。

于 2022-01-17T14:12:28.713 回答