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
• 27,640 points
281 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
• 67,380 points

Related Questions In Blockchain

0 votes
1 answer
0 votes
1 answer

How to send events in Hyperledger Composer?

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

answered Aug 24, 2018 in Blockchain by Perry
• 17,020 points
403 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,790 points
278 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
• 67,380 points
30 views