[英]Lightstreamer set connection options in JS
您好,我尝试理解这个库,我在第 187 行有一个 python 源代码https://github.com/ig-python/ig-markets-api-python-library/blob/master/trading_ig/lightstreamer.py我能够添加 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>
If the question is why Lightstreamer javascript SDK 8.0.3 library creates a different request, it is because the python code provided as reference (which doesn't lean on any SDK library) uses an earlier version of the communication protocol. 无论如何,javascript 库发出的请求应该可以工作。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.