pull down to refresh
Thanks @k00b you are 100% correct it is an event listener - not a background task. The behaviour is what I was going for - stopping the express server should stop the listener - so there's no cleanup necessary. I will update wording around that section. Thanks :)
This is going to be really useful for folks looking to get started on lightning.
Small nit about language: afaict you don't start a background process for listening to invoice events.
async function initLndClient() { await lndClient.connect(); const subscription = await lndClient.services.Lightning.subscribeInvoices(); subscription.on("data", (invoice) => { console.log("Lightning Invoice Event"); console.log(invoice); }); } initLndClient();In nodejs this just inserts an event listener in node's run loop. It kind of behaves like a background process, but if you kill your nodejs process, this event logging stops.