你好,我尝试理解这个库,我在这里有一个 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>