Im new to the concept of autobahn and I want to learn how to push the live stream of data from the push api into webpage. The below code gives the live stream of output in the console.I want to display it on the webpage.
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);
}
session.subscribe('BTC_XMR', marketEvent);
function tickerEvent (args,kwargs) {
console.log(args);
}
function trollboxEvent (args,kwargs) {
console.log(args);
}
session.subscribe('ticker', tickerEvent);
session.subscribe('trollbox', trollboxEvent);
}
connection.onclose = function () {
console.log("Websocket connection closed");
}
connection.open();
via Brijit
No comments:
Post a Comment