Skip to content

Commit

Permalink
node: emit tree commits over websocket
Browse files Browse the repository at this point in the history
Emit an event over websockets for the chain's 'tree commit'
event. NodeClient or any websocket client can listen to these
events.
  • Loading branch information
Mark Tyneway committed Jun 21, 2019
1 parent 3dfab6f commit 71a3677
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions lib/node/http.js
Original file line number Diff line number Diff line change
Expand Up @@ -655,6 +655,15 @@ class HTTP extends Server {
socket.fire('tx', raw);
}
});

this.chain.on('tree commit', (root, entry, block) => {
const sockets = this.channel('chain');

if (!sockets)
return;

this.to('chain', 'tree commit', root, entry, block);
});
}

/**
Expand Down

0 comments on commit 71a3677

Please sign in to comment.