-2

使用 node.js 我运行以下代码:

var autobahn = require('autobahn');
var wsuri = "wss://api.poloniex.com";
var connection = new autobahn.Connection({
  url: wsuri,
  realm: "realm1"
});

connection.onopen = function (session) {
        function marketEvent (args,kwargs) {
                console.log(args);
        }
        function tickerEvent (args,kwargs) {
                console.log(args);
        }
        function trollboxEvent (args,kwargs) {
                console.log(args);
        }
        session.subscribe('USDT_BTC', marketEvent);

}

connection.onclose = function () {
  console.log("Websocket connection closed");
}

connection.open();

并通过 push-API JSON-Data 恢复:

[ { type: 'orderBookModify',
    data: { type: 'bid', rate: '2357.77000002', amount: '0.82956965' } } ]

现在我想处理数据,是否可以将其存储到 mysql 中或仅使用 JSON-Array 序列声明一个变量?

4

1 回答 1

0

您可以使用 JSON.stringify 将 JSON 转换为字符串,然后将其保存到 MySQL 中。但是,我不确定您所说的 JSON-Array 序列是什么意思

于 2017-06-28T09:28:18.970 回答