Hyperledger Composer How to subscribe to and see events from transactions

0 votes

Code to connect to the Hyperledger Runtime:

const BusinessNetworkConnection = require("composer-client")
  .BusinessNetworkConnection;
this.businessNetworkConnection = new BusinessNetworkConnection();
this.CONNECTION_PROFILE_NAME = "hlfv1";
this.businessNetworkIdentifier = "testNetwork";
this.businessNetworkConnection
  .connect(
    this.CONNECTION_PROFILE_NAME,
    this.businessNetworkIdentifier,
    "admin",
    "adminpwd"
  )
  .then(result => {
    this.businessNetworkDefinition = result;
    console.log("BusinessNetworkConnection: ", result);
  })
  .then(() => {
    // Subscribe to events.
    this.businessNetworkConnection.on("events", events => {
      console.log("**********business event received**********", events);
    });
  })
  // and catch any exceptions that are triggered
  .catch(function(error) {
    throw error;
  });

When I submit transactions and make a request through my generated REST APIs no events are seen by my server. Need help

Nov 14, 2018 in Blockchain by digger
• 26,740 points
794 views

1 answer to this question.

0 votes

Here's the problem:

this.businessNetworkConnection.on('events' //This should be changed to the following:

this.businessNetworkConnection.on('event' 
answered Nov 14, 2018 by Omkar
• 69,210 points

Related Questions In Blockchain

0 votes
1 answer

How to download the full blocks (with transactions) directly and in parallel from the connected nodes in NodesGroup?

 just got informed, that NBitcoin currently does ...READ MORE

answered Jul 31, 2018 in Blockchain by Shashank
• 10,400 points
421 views
0 votes
1 answer

How to send events in Hyperledger Composer?

You define the event in your .cto ...READ MORE

answered Aug 25, 2018 in Blockchain by Perry
• 17,100 points
1,126 views
0 votes
1 answer

Hyperledger Sawtooth vs Quorum in concurrency and speed Ask

Summary: Both should provide similar reliability of ...READ MORE

answered Sep 26, 2018 in IoT (Internet of Things) by Upasana
• 8,620 points
1,237 views
+1 vote
1 answer

I am unable to change port of composer-rest-server. Please help!

Use full format for running a business ...READ MORE

answered Mar 27, 2018 in Blockchain by Christine
• 15,790 points
960 views
+1 vote
1 answer
0 votes
1 answer

Hyperledger Fabric 1.0 how to maintain privacy from OSNs?

Yes, OSNs can see all the transaction ...READ MORE

answered Jul 2, 2018 in Blockchain by Omkar
• 69,210 points
571 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