RadarTech / lnrpc

A Typescript gRPC client for LND with support for all LND sub-servers
MIT License
43 stars 13 forks source link

Hanging on subscribeHtlcEvents() #76

Closed MrHash closed 4 years ago

MrHash commented 4 years ago

Not sure why but cannot await this endpoint on the router rpc, node just hangs. subscribeInvoices() on invoices rpc works fine. Please advise.

cavanmflynn commented 4 years ago

Hey @MrHash, what's your usage look like? Methods that return a stream shouldn't be awaited.

MrHash commented 4 years ago

Looks like this. The first stream works fine, the second hangs.

const invoicesSubscriber = await lnd.lnrpc.subscribeInvoices({});
invoicesSubscriber.on('data', (invoice) => {
  console.log(invoice);
});

const htlcSubscriber = await lnd.routerrpc.subscribeHtlcEvents({});
htlcSubscriber.on('data', (event) => {
  console.log(event);
});

if i don't use await on the second call i get the error UnhandledPromiseRejectionWarning: TypeError: htlcSubscriber.on is not a function

cavanmflynn commented 4 years ago

Thanks, looking into this.

cavanmflynn commented 4 years ago

@MrHash A fix has been published in v0.10.0-beta.0

MrHash commented 4 years ago

Excellent, working fine now.