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,620 points
190 views

1 answer to this question.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
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
• 65,850 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
• 16,450 points
302 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
210 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
• 65,850 points
22 views

© 2018 Brain4ce Education Solutions Pvt. Ltd. All rights Reserved.
"PMP®","PMI®", "PMI-ACP®" and "PMBOK®" are registered marks of the Project Management Institute, Inc. MongoDB®, Mongo and the leaf logo are the registered trademarks of MongoDB, Inc.