You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
736 B
23 lines
736 B
import { status } from 'grpc'
|
|
import { mainLog } from '../../utils/log'
|
|
|
|
export default function subscribeToChannelGraph() {
|
|
const call = this.lnd.subscribeChannelGraph({})
|
|
|
|
call.on('data', channelGraphData => {
|
|
mainLog.info('CHANNELGRAPH:', channelGraphData)
|
|
if (this.mainWindow) {
|
|
this.mainWindow.send('channelGraphData', { channelGraphData })
|
|
}
|
|
})
|
|
call.on('end', () => mainLog.info('end'))
|
|
call.on('error', error => error.code !== status.CANCELLED && mainLog.error(error))
|
|
call.on('status', channelGraphStatus => {
|
|
mainLog.info('CHANNELGRAPHSTATUS:', channelGraphStatus)
|
|
if (this.mainWindow) {
|
|
this.mainWindow.send('channelGraphStatus', { channelGraphStatus })
|
|
}
|
|
})
|
|
|
|
return call
|
|
}
|
|
|