Re: 答复: [Hyperledger Fabric] How to send fabric chaincode events received in node.js application to angular application? #fabric-sdk-node


david liu <david-khala@...>
 

That is a general nodejs function, not specific for fabric. But AFAIK, you could use outside function and variable inside callback with `closure` pattern or even directly using the context scope.

 

Best Regards,

David Liu

+852 5982 3942

 


发件人: fabric@... <fabric@...> 代表 Prasanth Sundaravelu <prasanths96@...>
发送时间: Thursday, January 17, 2019 9:04:32 PM
收件人: fabric@...
主题: [Hyperledger Fabric] How to send fabric chaincode events received in node.js application to angular application? #fabric-sdk-node
 

Hi guys,
I'm using registerChaincodeEvent(ccid, eventCallBack, errorCallBack, options) to listen to events from my blockchain. The problem with this is that the eventCallBack function is not able to access variables or functions outside it. So, how could we pass the event received outside this callback function? I need to use the received event in server sent event (sse) which I have in another node.js application.

Thanks in advance.

Join fabric@lists.hyperledger.org to automatically receive all group messages.