SHARE
TWEET

Untitled

a guest Oct 14th, 2014 44,960 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var autobahn = require('autobahn');
  2. var wsuri = "wss://api.poloniex.com";
  3. var connection = new autobahn.Connection({
  4.   url: wsuri,
  5.   realm: "realm1"
  6. });
  7.  
  8. connection.onopen = function (session) {
  9.         function marketEvent (args,kwargs) {
  10.                 console.log(args);
  11.         }
  12.         function tickerEvent (args,kwargs) {
  13.                 console.log(args);
  14.         }
  15.         function trollboxEvent (args,kwargs) {
  16.                 console.log(args);
  17.         }
  18.         session.subscribe('BTC_XMR', marketEvent);
  19.         session.subscribe('ticker', tickerEvent);
  20.         session.subscribe('trollbox', trollboxEvent);
  21. }
  22.  
  23. connection.onclose = function () {
  24.   console.log("Websocket connection closed");
  25. }
  26.                        
  27. connection.open();
RAW Paste Data
Top