当我提到ticker
我有
['BTC_BBR','0.00069501','0.00074346','0.00069501','-0.00742634','8.63286802','11983.47150109',0,'0.00107920','0.00045422']
我需要将每个单元格写入一个单独的数组,例如
Arr1.push(BTC_BBR)
Arr2.push(0.00069501)
等等
如何连接可以通过参考
高速公路学习的图书馆
#include <autobahn/autobahn.hpp>
#include <autobahn/wamp_websocketpp_websocket_transport.hpp>
#include <websocketpp/config/asio_no_tls_client.hpp>
#include <websocketpp/client.hpp>
#include <boost/asio.hpp>
#include <boost/version.hpp>
#include <iostream>
#include <memory>
#include <string>
#include <tuple>
typedef websocketpp::client<websocketpp::config::asio_tls_client> client;
typedef autobahn::wamp_websocketpp_websocket_transport<websocketpp::config::asio_tls_client> websocket_transport;
void on_topic1(const autobahn::wamp_event& event)
{
std::cerr << "received event: " << event.argument<uint64_t>(0) << std::endl;
}
int main(int argc, char const *argv[])
{
try {
boost::asio::io_service io;
client ws_client;
ws_client.init_asio(&io);
ws_client.set_tls_init_handler([&](websocketpp::connection_hdl) {
return websocketpp::lib::make_shared<boost::asio::ssl::context>(boost::asio::ssl::context::tlsv12_client);
});
auto transport = std::make_shared < autobahn::wamp_websocketpp_websocket_transport<websocketpp::config::asio_tls_client> >(
ws_client, "wss://api.poloniex.com:443", true);
auto session = std::make_shared<autobahn::wamp_session>(io, true);
transport->attach(std::static_pointer_cast<autobahn::wamp_transport_handler>(session));
boost::future<void> connect_future;
boost::future<void> start_future;
boost::future<void> join_future;
boost::future<void> subscribe_future;
connect_future = transport->connect().then([&](boost::future<void> connected) {
try {
connected.get();
} catch (const std::exception& e) {
std::cerr << e.what() << std::endl;
io.stop();
return;
}
std::cerr << "transport connected" << std::endl;
start_future = session->start().then([&](boost::future<void> started) {
try {
started.get();
} catch (const std::exception& e) {
std::cerr << e.what() << std::endl;
io.stop();
return;
}
std::cerr << "session started" << std::endl;
join_future = session->join("realm1").then([&](boost::future<uint64_t> joined) {
try {
std::cerr << "joined realm: " << joined.get() << std::endl;
} catch (const std::exception& e) {
std::cerr << e.what() << std::endl;
io.stop();
return;
}
subscribe_future = session->subscribe("ticker", &on_topic1).then([&] (boost::future<autobahn::wamp_subscription> subscribed)
{
try {
std::cerr << "subscribed to topic: " << subscribed.get().id() << std::endl;
std::cerr << "---------------------" << argc <<std::endl;
}
catch (const std::exception& e) {
std::cerr << e.what() << std::endl;
io.stop();
return;
}
});
});
});
});
std::cerr << "starting io service" << std::endl;
io.run();
std::cerr << "stopped io service" << std::endl;
}
catch (std::exception& e) {
std::cerr << "exception: " << e.what() << std::endl;
return 1;
}
return 0;
}