2

I want to get correct data when connect to Poloniex push API use Wamp protocal Wampy.js implementation http://wamp-proto.org/implementations/

but I only got the last two data types right, the first one keep gives me "seq":

{"seq":76722908}

["BTC_ETH","0.02027380","0.02027377","0.02027355","0.06151162","29539.50716156","1478656.69569076",0,"0.02097800","0.01865820"]

["trollboxMessage",8755461,"reorx2112","made mill alrdy",9]

the official example and http://pastebin.com/dMX7mZE0 they use autobahn node.js module

this is my code below

script src="node_modules/wampy/build/wampy-all.min.js> script>

<pre>
    ws = new Wampy('wss://api.poloniex.com', {realm: "realm1"});
    ws.onopen = function () {
      //
      //subscribe to currency pair
      //this data type is not correct 
      //while other data looks normal
      //
      ws.subscribe('BTC_ETH',function (data) {
        console.log(data);
        document.getElementById("event").innerHTML=JSON.stringify(data);
        });
      //only get the raw data
      ws.subscribe('ticker',function (data) {
         if(data[0]==="BTC_ETH"){
             console.log(data);
             document.getElementById("ticker").innerHTML=SON.stringify(data);
          }
       });
       //chat box
       ws.subscribe('trollbox',function (data) {
          console.log(data);
          document.getElementById("trollbox").innerHTML=JSON.stringify(data);
            });
        };
    ws.onopen()</pre>

this question bugs me for a while......

Yadi
  • 21
  • 1
  • 8

0 Answers0