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,350 points
437 views

1 answer to this question.

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');
emit(basicEvent);

You can look up the same in the source here: https://hyperledger.github.io/composer/business-network/publishing-events.html

answered Aug 24, 2018 by Perry
• 17,020 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
• 26,550 points
405 views
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,170 points
92 views
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
• 26,550 points
348 views
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,600 points
268 views
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
• 26,550 points
80 views