Basic pusher connection to cryptsy using javascript

0 votes

I am trying to create a basic pusher connection to cryptsy. Since I am receiving public data such as 'price', I should 'not' have to authenticate, only providing the cryptsy APP_KEY. The following code fails:

<script src="pusher.min.js">
var pusher = new Pusher('cb65d0a7a72cd94adf1f');
var channel = pusher.subscribe('ticker.160');
channel.bind('new-price', function(data) {
  alert('An event was triggered with message: ' + data.message);
});
channel.bind('pusher:subscription_error', function(status) {
  if(status == 408 || status == 503){
    // retry?
  }
});
</script>

How do I make this work?

Sep 11, 2018 in Blockchain by digger
• 26,740 points
452 views

1 answer to this question.

0 votes

Try this

<script src="//js.pusher.com/2.2/pusher.min.js" type="text/javascript"></script>
<script type="text/javascript">
var pusher = new Pusher("cb65d0a7a72cd94adf1f");
var channel = pusher.subscribe("ticker.160");
channel.bind("message", function(data) {
  //console.log(data);
  var topbuy = data.trade.topbuy;
  console.log("Price: ", topbuy.price,
              "Quantity:", topbuy.quantity);
});
</script>
answered Sep 11, 2018 by slayer
• 29,360 points

Related Questions In Blockchain

–1 vote
1 answer

How to get balance of all accounts in ethereum network using javascript?

You can write a function that will ...READ MORE

answered Jan 10, 2019 in Blockchain by Omkar
• 69,230 points
2,251 views
+1 vote
3 answers

Is it possible to store data about arbitrary objects on the blockchain using smart contracts?

Basically you implement requested logic on by ...READ MORE

answered Aug 30, 2018 in Blockchain by Artem
1,331 views
+3 votes
2 answers

How to run ethereumjs using Node.JS

You need to install testrpc globally on ...READ MORE

answered Mar 27, 2018 in Blockchain by ned_crew
• 1,610 points
1,083 views
0 votes
1 answer

Connection failed to Ethereum Ropsten Testnet network.

 It looks like your node isn't syncing ...READ MORE

answered Mar 27, 2018 in Blockchain by Christine
• 15,790 points
1,567 views
+1 vote
3 answers

Removing double quotes from a string from JSON response in PHP

Just remove the json_encode call, and it should work: $resp ...READ MORE

answered Sep 12, 2018 in Blockchain by digger
• 26,740 points
44,572 views
0 votes
1 answer

How do I add multiple recipients for transactions via Blockchain API?

Convert the recipes into JSON objects. x = ...READ MORE

answered Jul 6, 2018 in Blockchain by Perry
• 17,100 points
740 views
0 votes
1 answer

Truffle tests not running after truffle init

This was a bug. They've fixed it. ...READ MORE

answered Sep 11, 2018 in Blockchain by Christine
• 15,790 points
1,782 views
+1 vote
4 answers

How to connect peers to a private network using geth?

Follow the below steps to connect peers ...READ MORE

answered Jul 13, 2018 in Blockchain by slayer
• 29,360 points
13,746 views
0 votes
1 answer

How to call external data using smart contracts?

Smart contracts can not directly call external ...READ MORE

answered Jul 16, 2018 in Blockchain by slayer
• 29,360 points
1,435 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP