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,720 points
536 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,170 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
153 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
756 views
0 votes
1 answer
+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,830 points
598 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,170 points
161 views