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 25, 2018 in Blockchain by sabby
• 4,390 points
1,100 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 25, 2018 by Perry
• 17,100 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,740 points
2,066 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,350 points
673 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,740 points
1,214 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
• 69,210 points
1,117 views
0 votes
1 answer

Hyperledger Sawtooth vs Quorum in concurrency and speed Ask

Summary: Both should provide similar reliability of ...READ MORE

answered Sep 26, 2018 in IoT (Internet of Things) by Upasana
• 8,620 points
1,215 views
+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,740 points
708 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP