How to send events in Hyperledger Composer?

0 votes

I know that in Chaincode, an event can be sent using the following command:

stub.SetEvent("<event name>", "<payload>")

How do I send a similar event in Fabric Composer? And how do I listen to this event in a Node.js application so that my UI can notify the user if a particular event happened already?

Aug 24, 2018 in Blockchain by sabby
• 4,050 points

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

You define the event in your .cto file like this:

event BasicEvent {

And emit the event from logic.js as given below:

// emit BasicEvent
var factory = getFactory();
var basicEvent = factory.newEvent('<your namespace>', 'BasicEvent');

You can look up the same in the source here:

answered Aug 24, 2018 by Perry
• 16,450 points

Related Questions In Blockchain

0 votes
1 answer

How to solve EACCES:permission denied error in Hyperledger Composer?

It seems like there is no required ...READ MORE

answered Jul 11, 2018 in Blockchain by digger
• 27,620 points
0 votes
1 answer

How to solve "error trying install composer runtime" in Hyperledger composer?

I think the docker-compose tool is not ...READ MORE

answered Jul 17, 2018 in Blockchain by slayer
• 29,040 points
0 votes
1 answer

How to generate events in Hyperledger Fabric?

You can generate events using a method ...READ MORE

answered Jul 26, 2018 in Blockchain by digger
• 27,620 points
0 votes
1 answer

How to get TimeStamps in Hyperledger Composer?

Here's an example that works with basic-sample-network network: asset SampleAsset ...READ MORE

answered Oct 26, 2018 in Blockchain by Omkar
• 67,000 points
0 votes
1 answer
+1 vote
1 answer
0 votes
1 answer

Invalid Batch or signature in Savtooth

This will solve your problem import org.apache.commons.codec.binary.Hex; Transaction txn ...READ MORE

answered Aug 1, 2018 in Blockchain by digger
• 27,620 points

© 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.